Re: strip_tags and nl2br
| From: | James Colannino | Date: | Wed, 21 May 2008 12:04:35 +0000 |
| Subject: | Re: strip_tags and nl2br | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274595@lists.php.net to get a copy of this message | ||
James Colannino wrote:
Chris wrote:And about 15 minutes later, it appears I'm eating my words... My code was fine upon injecting my data into its database. However, I run strip_tags again upon extracting the data, so of course that caused problems. I solved this by entering the data with newlines instead of tags, so only when displaying the data do I run nl2br() after running strip_tags. Now everything works fine. Sorry for the noise everyone. James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "When you do the common things in life in an uncommon way, you will command the attention of the world." --George Washington CarverAre you sure there are newlines before you run strip_tags?I would assume so, because everything from the textarea runs together in one line when displayed in the browser until filtered through nl2br(). That would suggest to me that there are indeed \n's that are being converted to <br>'s.