By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Html interpreation

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.