Re: Form results sent to file
| From: | Brian Clark | Date: | Mon, 19 Nov 2001 23:29:51 +0000 |
| Subject: | Re: Form results sent to file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75181@lists.php.net to get a copy of this message | ||
Hi Ben,
@ 6:08:20 PM on 11/19/2001, Ben Clumeck wrote:
BC> Does anybody have an easy script that send form results to a .txt file in
BC> comma separated format.
Be careful with commas in any of the fields. You may want to separate
the fields with something like | or :: instead.
<?php
/* in place of live post or get: */
$from_post_or_get = array('john','doe','red bud
lane','555-555-5555');
if(! $p = @fopen('/path/to/csv/file','a')) die("can't do it\n");
$line = implode(',',$from_post_or_get) . "\n";
fputs($p,$line,1024); // or: fputs($fp,$line,strlen($line));
fclose($p);
?>
<http://www.php.net/manual/en/function.fgetcsv.php>
--
-Brian Clark | PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.