Jump to content


Photo

nl2br() question


  • Please log in to reply
4 replies to this topic

#1 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 29 August 2006 - 11:23 PM

alright im using nl2br() to make new lines and i got a textarea to view your current signature

is thier a way for the <BR>'s to be hidden in edit script script but the <br> still work?
'
like hidden <BR>'s in textarea's

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 29 August 2006 - 11:24 PM

is thier a way for the <BR>'s to be hidden in edit script script but the
still work?


That doesn't make sense

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 August 2006 - 11:30 PM

Use str_replace:
$text = str_replace(array("<br>", "<br />"), '', $text);

I guess you use nl2br when inserting data to the database, this is not recommended. You should save data in its raw state in the database. Then you format the data how you want it to be displayed when you get it out of the database.

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 29 August 2006 - 11:57 PM

Also, you'd be much better off storing th eplain text in the database and using nl2br() on the way out.

#5 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 30 August 2006 - 12:14 AM

wow wildteen and thorpe is back :) *waves*

thanks ill fix it now :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users