View Full Version : check for bad words

04-27-2006, 10:41 AM
can someone help me with the following --

I want to loop through all the fields from the form collection and then check through a list of words (badwords) and if any of those words exist in the form then to set a variable $filtered=1

04-27-2006, 10:50 AM
$badwords = array("feck", "arse", "boobs");
foreach($_POST as $val)
foreach($badwords as $swear)
if(strpos($val, $badwords)!==false)

or something similar

06-21-2006, 07:57 PM
does not seem to be working properly.
shouldn't this take out any word in the form? (regardless of wether there is a space before and after?)
also how can I make it not case sensitive?