Re: new lines in text field
| From: | Hugh Bothwell | Date: | Mon, 30 Jul 2001 17:21:48 +0000 |
| Subject: | Re: new lines in text field | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10912@lists.php.net to get a copy of this message | ||
"Kenn Murrah" <warden@bakergrfx.com> wrote in message
news:NDBBIGIIILNKOAGPCFEAKEDOHEAA.warden@bakergrfx.com...
> I'm trying to concatenate several values entered in my form, then write
them
> to a TEXT field in my mySQL database. All is well, except that I want to
> each value to appear on a different line. I've tried \n and that didn't
> work. What am I doing wrong?
You skipped a step here, between "write it to my database" and
"appear on a different line".
I assume that you insert to the database, then pull it out and
display it as HTML. '\n' doesn't cause a line-break in HTML.
You can either use "<br>" instead of "\n" before putting it in
the database (less portable), or look at the nl2br() function
(I would prefer this option, personally).