Sugapablo wrote:
sinapsi wrote: I'm writing a little forum forum for my website. How can I avoid html
code interpretation if a user try to post it in the forum?
http://www.php.net/manual/en/function.strip-tags.php
This does not do what sinapsi is asking for. It removes HTML tags from the
input - which is completely different to stopping the HTML from being
rendered. What if you want to discuss HTML? It can get very annoying.
sinapsi, the problem is that your users are entering characters that HTML
treats in a special way, such as the less-than sign (<). The correct
solution is to encode these characters in one of the ways that HTML allows
you to (in the case of the less-than sign, this might be <).
PHP provides the htmlentities() function that does this. Instead of:
echo($input);
....you want:
echo(htmlentities($input));
<URL:http://www.php.net/htmlentities>
--
Jim Dabell