Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function populate_csv( $entry, $form ) {
  2.  
  3. //Headers info
  4. $headers = array('Nominee', 'Reason', 'Justification');
  5.  
  6. //Build form data
  7. $data = array(
  8. 'Nominee' => rgar( $entry, '1' ),
  9. 'Reason' => rgar( $entry, '4' ),
  10. 'Justification' => rgar( $entry, '3' ),
  11. );
  12.  
  13. //Open or Create CSV File
  14. $fh = fopen('Nominations.csv', 'w');
  15.  
  16. //Create headers
  17. fputcsv($fh, $headers);
  18.  
  19. //Populate the data
  20. fputcsv($fh,$data);
  21.  
  22. //Close the file
  23. fclose($fh);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement