Hi
I have a simple form with textarea for text. I want to check that people don't insert there html tags.
Is there an easy way to do so?
Thanks!
[man]strip_tags/man
Thanks this do half of the job I need 🙂 I need to know if it acctually removed tags. Because it is an email form if there are tags I know for sure that it is a spam and then I wouldn't want to send the email. Any idea how to do it?
Thanks
There may be better ways, but check if the length of the string is changed before and after strip_tags have been used would work.
You could compare the original text to the stripped text. If there's no difference, then no tags were found and stripped:
if(strlen($text) == strlen(strip_tags($text))) { // no tags found } else { // 1 or more tags were found }
Thanks all for your help 🙂