Re: [PHP] strip_tags and nl2br



James Colannino wrote:
Chris wrote:

Are 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.

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 Carver
.



Relevant Pages

  • Re: [PHP] Re: FImage $aSubDir
    ... John Taylor-Johnston wrote: ... But instead of displaying. ... I would like to open and nl2br the contents of a like named text file. ... You could use the fopen function (surprise, surprise) and the nl2br function later on. ...
    (php.general)
  • Re: New lines from php to mysql
    ... > I recently started to use nl2br() when displaying ... > text from a mysql database. ... You should not alter the \n's when inserting, only when displaying to the ...
    (comp.lang.php)
  • Re: FImage $aSubDir
    ... John Taylor-Johnston wrote: ... But instead of displaying. ... I would like to open and nl2br the contents of a like named text file. ... echo substr; ...
    (php.general)
  • FImage $aSubDir
    ... But instead of displaying. ... Instead of displaying the file name under the photo, weak excuse for a caption, ... I would like to open and nl2br the contents of a like named text file. ... echo substr; ...
    (php.general)
  • Re: asp.net chinese encoding
    ... symbol characters on the browser. ... when displaying converted date strings to the browser i am ... abbreviation showing the corresponding chinese character symbols. ... > on the browser occurs with multiline textbox. ...
    (microsoft.public.dotnet.languages.csharp)