fsFormTopic fsFormFields fsFormPublished
This question has been answered by sottwell. See the first response.
$fileName = 'formit-export-'.time().'.csv';
[[!FormIt? &hooks=`FormitSaveForm` &formFields=`name,email,text` &fieldNames=`name==Name,email==Email,text==Message` ]]
IP;Date;Name;Email;Message ::1;"2016-01-04 9:39 am";"Susan Ottwell";[email protected];"This is a test."
Ok. Did some testing. This formit snippet
[[!FormIt? &hooks=`FormitSaveForm` &formFields=`name,email,text` &fieldNames=`name==Name,email==Email,text==Message` ]]
Produces this .csv
IP;Date;Name;Email;Message ::1;"2016-01-04 9:39 am";"Susan Ottwell";[email protected];"This is a test."
So it has a header row by default, you can select which fields to save and what to name them for the .csv header.
fputcsv($fp, $keys, ';');
fputcsv($fp, $keys, ',');
fputcsv($fp, array_merge($defaultArr, $objectArray['values']), ';');
fputcsv($fp, array_merge($defaultArr, $objectArray['values']), ',');