Re: Carriage returns in a field

From: Date: Mon, 26 Apr 2004 14:59:41 +0000
Subject: Re: Carriage returns in a field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184659@lists.php.net to get a copy of this message
"Brian Dunning" <brian@briandunning.com> wrote in message news:E8A0F19E-978F-11D8-8570-000A95BD6AE4@briandunning.com... > I am using a <textarea> entry field and I want returns to be preserved > when that form output is shown on a page later. Currently returns are > not being preserved: they just output as a space so the text is all one > big paragraph. > > 1) Do I need to do anything special when I write the <textarea> to > mysql, and No. > > 2) Do I need to do anything special when I output the query result to > preserve the returns that were typed? Use nl2br(): echo nl2br($text); This will insert a <br> at any linefeed position. Regards, Torsten > > TIA, > - Brian

« previous php.general (#184659) next »