Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- trouble formatting text
December 21, 2007, 4:49 pm
rate this thread
I am trying to submit text to a mysql database. I want to be able to
allow formatting of this content (like breaking it up into
paragraphs). I am sending the data to the server via ajax, and so
escape the characters.
When I read back the information on my news page, all of the
formatting is gone. Do I need to unescape the charachters somehow
Any help is appreciated
Re: trouble formatting text
If the text was entered in a text area for example, then of course it
only contains normal line breaks. If you want to print it out as HTML,
then you either have to call nl2br() (be aware that it returns XHTML)
or - better - replace the line breaks with proper 'p' elements.