Forum Moderators: coopster

Message Too Old, No Replies

Preformat text in php

         

shashank_hi

4:21 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



Hi,

I've got a text area and the form in which it is connects to a php file. Now, the text that is entered by the user may contain breaks. However, when I try displaying that text by using echo, it shows all in one, without breaks.

I tried using the pre tags, but then if the user enteres a long string, i get a horizontal scroll bar. Is there any way to convert the breaks in a given string into tags (ie. introducing <BR> at the right place). Or else, if there is some way of wrapping text within pre, i could use that as well.

sned

4:27 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



I believe the nl2br [us2.php.net] function is what you are looking for.

-sned

shashank_hi

2:57 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



Hey sned, thanks a lot. that works.