Page 1 of 1

Line breaks dissapear when I write it to file

Posted: Thu May 20, 2004 3:17 pm
by Canole
Hello all,

it sounds stupid, I know, but I cannot keep my line breaks from text of a TEXTAREA returned by a POST action. I write my data from the post to a txt file. But even before I write them I print the returned value (from the post) and the line breaks are all gone!!!! Is there not an equivilant value in URL coding to keep line breaks when posting from one form to another.

To give more details, my first page is a regular HTML used to get info from user. I then post this form to a php page that retrieves the values and writes it to a txt file and displays the info transmitted on the page. I have a link to another page that displays all info written to the txt file. All the info is there but the darn line breaks, especially the ones from a textarea input type on the HTML page. They don't follow to the php page.

I tried to set the set_magic_quotes_runtime function to 0, no effect. I tried to inpose a lenght on the fwrite function, that was no good. Using stripslashes function or not does nothing for me. Do I have to use strtok?

thanks ahead

Canole

Posted: Thu May 20, 2004 3:25 pm
by xisle
try <textarea wrap=physical>

Posted: Thu May 20, 2004 3:31 pm
by lostboy
nl2br() is a function that replaces the line breaks with the <br> tag

Posted: Thu May 20, 2004 3:38 pm
by Canole
Thanks every body. the nl2br function is perfect. I also found ereg_replace to help me out here.

thanks again

Canole