HTML formated text in TextArea

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

HTML formated text in TextArea

Post 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
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

\n => <br>

Post by gite_ashish »

hi,

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

regards,
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Post 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
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Post by gite_ashish »

Post Reply