Cara Menyimpan Variabel PHP ke dalam File CSV

html code:

< form action="download.php" method="post" >
          <input type="submit" value="Simpan dalam bentuk .CSV">
<input type="hidden" name="csv" value="$csv">
        </form>

php code:

<?php
header("Content-type: text/csv");
header("Content-disposition: attachment;filename=csv" . date("Y-m-d") . ".csv");
   print $_POST['csv'];
   exit;
?>
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.