RE: [PHP] nl2br

From: Date: Wed, 11 Jun 2003 20:32:21 +0000
Subject: RE: [PHP] nl2br
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151136@lists.php.net to get a copy of this message
thanks John, I will give that a shot. -----Original Message----- From: CPT John W. Holmes [mailto:holmes072000@charter.net] Sent: Wednesday, June 11, 2003 4:18 PM To: Edward Peloke; Php-General@Lists. Php. Net Subject: Re: [PHP] nl2br > I am trying to create a very basic page where we can all easily work on a > document. I just have a huge textarea that inserts the text into a longtext > field in the mysql db. I use nl2br to keep the formatting. Of course, when > the document is viewed in the textarea, all of the <br /> are there. THe > problem is, everytime I update the text in the textarea, another set of <br > />'s are put in so with every edit, the lines get farther and farther > apart...why? So stop using nl2br() on the data before you put it in the database. You only use nl2br() when it's displayed on a webpage as HTML. If you're displaying the data in a textarea, you should be running htmlentities() on it before you put it between <textarea> and </textarea> tags. ---John Holmes...

« previous php.general (#151136) next »