RE: [PHP-DB] nl2br()

From: Date: Wed, 21 Feb 2001 21:52:51 +0000
Subject: RE: [PHP-DB] nl2br()
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6841@lists.php.net to get a copy of this message
If you have a bunch of text that is properly formatted with carriage returns/linefeeds between the paragraphs and you then try to send this to a browser, the carriage returns/linefeeds will be ignored and you wind up with one big paragraph. You could surround the whole thing with <pre> and </pre>, but the nl2br($string) function will nicely replace each linefeed with the <br> tags and display what you want in the browser. Thus, you can store several paragraphs of data in database text field with the CR/LF, but when it is time to show this on a page, run it though nl2br(). This way, you have the convenience of editing the field's data normally, but the formatting flows through to the screen. I'll stop typing now, since I am getting a little long in the tooth. John > -----Original Message----- > From: Matthew Cothier [mailto:matthewcothier@hotmail.com] > Sent: Wednesday, February 21, 2001 4:11 PM > To: php-db@lists.php.net > Subject: [PHP-DB] nl2br() > > > Where exactly do I need to insert this? > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#6841) next »