Re: Form Data Filtering

From: Date: Sat, 16 Jun 2007 20:30:18 +0000
Subject: Re: Form Data Filtering
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-257187@lists.php.net to get a copy of this message
OK, I'm still getting "Undefined Index" error. Please view code below. foreach($_POST as $field => $value) { if ($value == "") { $blank_array[$field] = "blank"; } if($field == "conZip" || $field == "schZip") { if (!ereg("^[0-9]{5}(\-[0-9]{4})?$",$_POST[$field])) { $format[$field] = "bad"; } } $profanity = array("fuck", "shit", "whore", "hoe", "bullshit", "ass", "asshole","piss","bitch","bastard","bastard","motherfucker", "pussy","cunt","slut","hell","goddamn","minx","skank","tit","wanker","dick","twat","whore"); if ($value == in_array(strtolower($_POST[$value]),$profanity)) { $profanity[$field] = "bad"; } } if(@sizeof($profanity) > 0) { echo "<div class='ermess1'><br />Please <b>REMOVE</b> the profanity in the following fields. Immediately!</div>"; foreach($profanity as $field => $value) { echo "&nbsp;&nbsp;<div>{$label_array[$field]}</div>"; } }

« previous php.general (#257187) next »