Possible Duplicate:
Why entered key word is not store in database?
I’m writing a simple page in which users can enter a testimonial about the website into a textarea box. This gets stored in my database inside a table called testimonials under “testimonial” which is of type text(1000)
When I try to retrieve the testimonials and present them and an unordered list, newlines get ignored.
For example:
I hate this website.
It has tons of bugs.
Will print as
- I hate this website. It has tons of bugs
How would one preserve the newline the user entered?
EDIT: I should mention that the testimonial is stored correctly with newlines in the database, when I look at it in phyMyAdmin
As a browser will not render
\nyou need to use a function called nl2br() to replace new lines with<br/>