Re: save to file
| From: | Niels Andersen | Date: | Sun, 09 Mar 2003 08:09:24 +0000 |
| Subject: | Re: save to file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138840@lists.php.net to get a copy of this message | ||
You want to add a new line every time your form is submittet, am I right?
Then you should open the file for appending, using fopen(filename, "a")
instead of "w"
"Ryan Holowaychuk" <ryan@hgilive.com> wrote in message
news:!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAu5ugyx6+hUW5gsOu6grgVMKA
AAAQAAAAGYzyr/XD3kWb/09A0lRMLwEAAAAA@hgilive.com...
> I am trying to save to a text file. And I have managed to do that part
> now, but what happens is when I save to the file, all the lines get put
> into one big line in the file.
>
> I am creating a roster input that I adding to our website: No, name
> grade .....
>
> The roster will contain 15 players
>
> So right now the implode puts everything on one line in the text file!!!
>
> So I am no sure if anybody can shed some light on this one.
>
> Thanks again
> Ryan
>
> <?
> //create a new file
> $fp = fopen("/place/on/server/" . $HTTP_POST_VARS['team'] ,
> "w");
>
> $file_data = implode("\t\", $_POST);
> //this would return values spit by tabs
> //write to the open file handle
> fwrite($fp, $file_data . "\r\n");
> //close the file
> fclose($fp);
>
> ?>
>
>
>
>
>