By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

trouble formatting text

P: n/a
Hi, I'm having trouble using the proper terminology, so bear with me,
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
using javascript or php?

Any help is appreciated
Dec 21 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rozzy <ro*****@gmail.comwrote in news:50f642c7-8efd-4e4b-8234-
c4**********@21g2000hsj.googlegroups.com:
Hi, I'm having trouble using the proper terminology, so bear with me,
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
using javascript or php?

Any help is appreciated
What is your definition of "formatting"? Line breaks? If so, are you
calling nl2br('databasevalue') before printing to the page?
Dec 21 '07 #2

P: n/a
..oO(Rozzy)
>Hi, I'm having trouble using the proper terminology, so bear with me,
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
using javascript or php?
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.

Micha
Dec 21 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.