The function you need is called nl2br:


On Jan 6, 2006, at 5:34 AM, swoll2 wrote:

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 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

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to