470,815 Members | 1,290 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Html interpreation

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?

thnx
Jul 16 '05 #1
3 2011
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?

thnx

http://us3.php.net/manual/en/function.strip-tags.php

Jul 16 '05 #2
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 &lt;).

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

Jul 16 '05 #3
sinapsi <in**@zam.it> 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?

thnx


htmlentities(), htmlspecialchars(), striptags()

http//php.net/manual

--
Eivind Lie Nitter
el*@gmx.net
http://ununique.net
Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Boris Ammerlaan | last post: by
20 posts views Thread by Al Moritz | last post: by
6 posts views Thread by Ludwig77 | last post: by
5 posts views Thread by serge calderara | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.