Thank you very much for your code. I got next error message,” Parse error: parse error, unexpected '<' in /homepages/41/d182358255/htdocs/comment/confirm.php on line 52” I am not sure if I created correctly file “badwords.text” Is it correct format,” sex, Viagra, adult”? [quote author=php_joe link=topic=112822.msg458101#msg458101 date=1161883256] Make a list of words to add to the filter. Then put this at the top of the php file: [code]$badwords = file("badwords.txt"); foreach($badwords as $key => $value){ if (eregi($value, $contents)){ echo "Error, no comments were submitte.You may not have any rude words in your comment!"; die(); }else{ $to = "1994@hotmail.com"; $subject="Comment"; $from="Dan's Website"; if($contents != "") { //send mail - $subject & $contents come from surfer input mail($to, $subject, $contents, $from_header); // redirect back to url visitor came from } else { print("<HTML><BODY>Error, no comments were submitted!"); print("</BODY></HTML>"); } } } [/code] I'm sure there's a better way then cycling through each bad word, maybe someone else can offer it. :) Though I think that you shouldn't tell the spammers that you're filtering their messages or they will just alter the words slightly (like using a one instead of a lower case "L", or putting a period in the wo.rd). Joe [/quote]