Re: nl2br
| From: | CPT John W. Holmes | Date: | Wed, 11 Jun 2003 20:17:40 +0000 |
| Subject: | Re: nl2br | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151132@lists.php.net to get a copy of this message | ||
> 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...