PDA

View Full Version : Is there a way to disable html tags?


DustyJoe
11-06-2012, 01:20 AM
I have a form with a textarea that when submitted saves to a database...

when I pull the data entered from the text area from the database and display it on my site, I would like to disable all html tags and only allow text..

That way if someone enters <img src=blahblah> instead of showing the image, it will just show the tags... or not allow it at all?

I know this can be done, but my brain is broken at the moment.

Thanks.

kh99
11-06-2012, 01:52 AM
If you call the function htmlspecialchars_uni() on a string, it will convert any special html chars to their "enitites" so they will display instead of acting as tags.