0

How I can block HTML codes in my form? So, when someone enter a HTML code, it's not usable...

It's for a comments system...

3 Answers 3

5

http://www.php.net/manual/en/function.htmlspecialchars.php

htmlspecialchars()

Sign up to request clarification or add additional context in comments.

1 Comment

It's much better to either escape HTML so it's displayed in the browser or to detect if the content has HTML and display an error such as "HTML not allowed" instead of removing the HTML. By removing or replacing content, you can end up with a much bigger problem en.wikipedia.org/wiki/Scunthorpe_problem
1

You could just use strip_tags.

Comments

1

You would want to use HTMLEntities. It will escape all special entities like <>.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.