|
Posted by sumeet on 09/18/05 11:27
Andy wrote:
> "Andy" <Andy@invalid.com> wrote in message
> news:3MSdndBSZMHul7DeRVn-sg@rogers.com...
>
>>I want to capture information from a form and write that to a CSV. Could
>>you give me a simple script to do it. For example how to capture email
>>address from a form. Thank You in advance.
>>
>
>
> I got it LOL.
>
> $filename = "anything.csv";
> touch ("$filename");
> $fpc = fopen($filename, "a") or die ("Couldn't open $filename");
> fputs($fpc,"\n$_POST[from], $_POST[email], $_POST[subject],
> $_POST[message]");
> fclose($fpc);
>
>
there is only one problem. suppose 'subject' or 'message' contains a
comma i.e. 'Las Vegas Crime Lab, USA'.
solution
fputs($fpc,"\n\"$_POST[from]\", $_POST[email], \"$_POST[subject]\",
\"$_POST[message]\"");
sumeet shroff
[Back to original message]
|