retaining and displaying line returns in a text field
| From: | swoll2 | Date: | Fri, 06 Jan 2006 11:34:52 +0000 |
| Subject: | retaining and displaying line returns in a text field | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40989@lists.php.net to get a copy of this message | ||
Good morning -
I'm trying to get a text field with line returns in it to be stored,
retrieved, and displayed the way it gets entered.
Specifically, my users use a form field (html textarea) to enter some
remarks....as they enter their remarks, they can hit Enter to insert a hard
return, which is reflected in the textarea on their screen.
Example entry:
this is line1.
this is line2.
this is line3.
Those remarks get uploaded into a mysql db, into a field defined as a text
field named rmks.
If I use PhpMyAdmin to browse the table, it shows the entry with the lines
separated, but there are no /n's or other control characters visible.
Later, the field is retrieved from the db using a php script and assigned to
a variable $rmks....when I echo $rmks, it displays on a single line without
the line returns, like this:
this is line1.this is line2.this is line3.
I have tried to work with addslashes and stripslashes, but neither has
worked. I think I'm just missing something basic....
Appreciate any help or points to previous discussions......thanks...Steve