Well, instead of storing the text from the textarea directly into the db, validate it and wrap it with <br /> tags (replace \n) and then store it. This way you needn't use nl2br every time you retrieve the text from db. -Sterex On Fri, May 15, 2009 at 7:42 PM, Stuart <stuttle@xxxxxxxxx> wrote: > 2009/5/15 PHPScriptor <contact@xxxxxxxxxxxxxxx>: > > > > Hello, > > > > How do you guys handle this "problem". > > > > Just a form with a textarea. When I use enters in the textarea it's saved > to > > the db like this: > > > > database: > > "first line > > second line" > > > > when I edit the value in the form: > > "first line > > second line" > > > > when I output the value to html: > > "first linesecond line" (unless I use nl2br()) > > > > Is there a way that I could save it to the db that will work for db, > output > > and edit without using any other function like nl2br? > > What's your problem with using nl2br? This is the reason it exists!! > > Store the raw data in the database, and run nl2br on it when you > display it. I don't see a "problem". > > -Stuart > > -- > http://stut.net/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >