Cool kid asked:
I have a text form, and it posts messages to my website. However, if I want to go to a new line within that message, i.e. within that text area, I need to automatically add
. Is there someway of php detecting the end of a line and adding
automatically?
I have a text form, and it posts messages to my website. However, if I want to go to a new line within that message, i.e. within that text area, I need to automatically add
. Is there someway of php detecting the end of a line and adding
automatically?


2 Comments to 'How can I make php automatically add at the end of each line in a text area?'
September 26, 2009
with out php you can
this will add a \n
September 26, 2009
Simple function called nl2br. Once you call the text from the form let say $_POST[text]
put it into new variable
$text_with_br=nl2br($_POST[text]);
and then echo it
echo $text_with_br;
Leave a comment