Re: retaining and displaying line returns in a text field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function you need is called nl2br:

http://us2.php.net/nl2br

-Jordan


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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux