Click to See Complete Forum and Search --> : line breaks...


chadypu
10-17-2003, 11:35 AM
i have a text area and on submit it saves the text/html they put in into a mySQL field...

but since the people using my script probably wont know html how can i have it so that every return in the text area would convert to a <BR>

i hope that makes sense
-chadypu

pyro
10-17-2003, 12:07 PM
http://www.php.net/nl2br should be just the ticket...

chadypu
10-17-2003, 02:50 PM
well i guess that it does keep the linebreaks in the mySQL

but when i retrieve it it gets rid of the linebreaks

so how can i keep the linebreaks when i grab it?

i found this... $con = nl2br($con);
$con = str_replace("<br />", "<br>", "$con")

ill try it later cause im busy but it should do the trick right?

pyro
10-17-2003, 03:27 PM
Yep, on it's way out of the DB, just run it through nl2br()...

chadypu
10-18-2003, 12:02 PM
thanks again man it worked great

pyro
10-19-2003, 07:49 PM
Sure thing... :)