Download To File

We can create a link (Download CSV) to a PHP script (in this case I called it download-csv.php which causes the browser to ask the user if they want to save the data sent by the script. The code in the download-csv.php is:


  <?php
  header('content-type: text/csv');
  header('content-disposition: attachment;filename=ticket-sales.csv');
  echo "a, b, c, d, e";
    

Get the picture!