Page 1 of 1

Saving Textarea to text file

Posted: Sun Apr 09, 2006 3:20 pm
by austellpgrammer
When I save textarea to my text file, it does not save correctly.

textarea as entered in the form.
line 1
line 2
line 3

saves as:
|line 1
line 2
line 3|

It's trying to save as it was entered but each line in the text file represents
a seperate record.

If I have the following fields:
$username
$notes (textarea)
$date

It will display in the text file as:
John Doe||03/09/06
Jane Doe||03/09/06
James Doe|line 1
line 2
line 3|03/09/06

So now when I list the first record (name) in the text file, I get:
John Doe
Jane Doe
James Doe
line 2
line 3

Help, newbie here wasted three days on this.
Doing the same on PHP 4 and PHP 5.

Posted: Sun Apr 09, 2006 3:47 pm
by feyd
use addslashes(), or a similar function to convert the textarea into a single line string.