Click to See Complete Forum and Search --> : Removal of HTML tags
AmazingAnt
07-06-2006, 02:55 PM
Ok, on my page i've got the variable $newpost which is added to a text file. It's working fine, no problem. (Big thanks to NogDog for that) But i've noticed that you can add HTML tags to it, and they then become part of the page that views the file. Apparently, other people have found this out as well. Is there any fancy way you great people can think of for php to remove html from the variable?
bokeh
07-06-2006, 02:57 PM
strip_tags() (http://www.php.net/striptags)
felgall
07-06-2006, 02:59 PM
$newpost = htmlentities($newpost);
to convert the code so it displays as text.
AmazingAnt
07-06-2006, 04:00 PM
Thanks again bokeh! And although I don't quite need to convert the html into text, I think I may do that just to annoy anyone who posts html tags. So thanks to the both of you!