retrieving content from textarea
Posted: Sun Jul 16, 2006 9:15 pm
I have a form with one textarea for comments.
The problem is when there are line breaks (by pressing [enter]).
When I build the INSERT query for MySQL, the source code is semething like this:
INSERT INTO [table] (comments) VALUES ('This is my comment
with holy breaks')
Although It works, when this data is shown on the page, the source code is this:
<td>This is my comment
with holy breaks</td>
The point is that I need to display this content using overlib (javascript library) and It doesn't like these breaks, and it doesn't work.
The string should be like this: This is my comment<br />with holy breaks.
I've tried using PHP's function nl2br(), but I get the same string with boths elements: page break and <br />:
"This is my comment<br />
with holy breaks."
And that is even worst!
I'm also using smarty template, and it has a internal function nl2br too, but I get the same result.
What on earth is the problem?!
Thanks!
The problem is when there are line breaks (by pressing [enter]).
When I build the INSERT query for MySQL, the source code is semething like this:
INSERT INTO [table] (comments) VALUES ('This is my comment
with holy breaks')
Although It works, when this data is shown on the page, the source code is this:
<td>This is my comment
with holy breaks</td>
The point is that I need to display this content using overlib (javascript library) and It doesn't like these breaks, and it doesn't work.
The string should be like this: This is my comment<br />with holy breaks.
I've tried using PHP's function nl2br(), but I get the same string with boths elements: page break and <br />:
"This is my comment<br />
with holy breaks."
And that is even worst!
I'm also using smarty template, and it has a internal function nl2br too, but I get the same result.
What on earth is the problem?!
Thanks!