Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['kvcArray'])) {
  3.  
  4. $myArray = $_POST['kvcArray'];
  5. $test = (json_decode($myArray, true));
  6.  
  7. date_default_timezone_set('Asia/Calcutta');
  8. $filename = "data-" . date('dmY-His') . ".csv";
  9.  
  10. require_once 'db.php';
  11. header('Content-Type: text/csv; charset-utf-8');
  12. header('Content-Disposition:attachment;filename="' . $filename . '"');
  13. $output = fopen("php://output", "w");
  14. fputcsv($output, array('Wedding Guest List', 'id', 'Salutation', 'First Name', 'Last Name', 'Guest Group', 'Phone no 1', 'Phone no 2', 'Email Id 1', 'Email Id 2', 'Address', 'Area', 'City', 'Country', 'Pin Code', 'Spouse Name', 'Spouse Last Name', 'Spouse Phone no', 'Spouse Email Id', 'Child 1 Name', 'Child 2 Name'));
  15.  
  16.  
  17. while ($row = $test) {
  18. fputcsv($output, $row);
  19. }
  20. fclose($output);
  21. }
  22.  
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement