Posted By

apricot_13 on 10/18/10


Tagged

csv export


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

AllKnightAccess


Create CSV


 / Published in: PHP
 

  1. if (!empty($form_data)) {
  2. foreach ($form_data as $line) {
  3. echo implode(',', $line)."\r";
  4. }
  5. $csv_data = ob_get_contents();
  6. $file_name = 'webinar'.$_REQUEST['id'].'.csv';
  7. header('Content-Type: application/octet-stream');
  8. header('Content-Length: '.strlen($csv_data));
  9. header('Content-Disposition: attachment; filename='.$file_name);
  10. header('Content-Transfer-Encoding: binary');
  11. echo $csv_data;
  12. }

Report this snippet  

You need to login to post a comment.