Page 1 of 1

HTML formated text in TextArea

Posted: Tue Sep 03, 2002 8:08 am
by PingLeeQuan
Hello... I am writting a "news" tool that should produce different paragraphs and indentations. When i use the textarea tag, the result is all teh text appears as 1 big paragraph ignoring teh <CR> and the line breaks. I do not want to use actual HTML tags (i.e. <br> and <P>). Is there a way this can be done in PHP.

Thanks

\n => <br>

Posted: Tue Sep 03, 2002 8:31 am
by gite_ashish
hi,

you can use nl2br() to convert the <TEXTAREA>'s new line into HTML's <BR> tag.

regards,

Posted: Tue Sep 03, 2002 9:27 am
by PingLeeQuan
Thanks gite_ashish i guess by using the nl2br in combination with eregi_replace i can also replace "Returns" to <p> tags.

thanks again

Posted: Tue Sep 03, 2002 9:47 am
by gite_ashish