Re: Sending Form Result to File
| From: | Hank Marquardt | Date: | Thu, 29 Nov 2001 23:41:01 +0000 |
| Subject: | Re: Sending Form Result to File | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76131@lists.php.net to get a copy of this message | ||
<?php
$fd =
fopen("/tmp/myformoutputdirectory/".md5(microtime()).".txt","w+");
fputs($fd,implode("|",$HTTP_POST_VARS));
fclose($fd);
?>
caveats ...
it just assumes you'll figure out the output from the form data --
filenames will be random .txt files written to the /tmp directory (which
avoids all kinds of permission problems I'd otherwise need to discuss).
uses the "|" (pipe) character instead of commas so you can have commas
in the output itself ... I believe that Excel allows you to choose the
delimiter, so that shouldn't be a problem.
I did no error checking on the open or put statements ... you really
should in a production script.
On Thu, Nov 29, 2001 at 04:34:06PM -0800, Ben Clumeck wrote:
> I am looking for a script to send my form results to a .txt file in CSV (to
> import into Excel) format. Does anyone have a simple code?
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Hank Marquardt <hank@yerpso.net>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D 3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild
*** Beginning PHP -- Starts January 7, 2002
*** See http://www.hwg.org/services/classes