Re: Preventing Identical Form Fields
| From: | Jeff Sheltren | Date: | Thu, 07 Feb 2002 17:03:35 +0000 |
| Subject: | Re: Preventing Identical Form Fields | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83873@lists.php.net to get a copy of this message | ||
Hi, I think that you could still use Chris' method, you will just have to do it in a loop. Create an array of all the form fields, and then have a nested for loop which just checks that none of the elements are equal.
$numelements = count($fieldarray);
for($i = 0; $i < $numelements; $i++) {
for($j = 0; $j < $numelements; $j++) {
if($j != $i) {
if($fieldarray[$i] == $fieldarray[$j]) {
sendbackwitherrors();
}
}
}
}
Hope that helps.
Jeff
At 11:42 AM 2/7/2002 -0500, Dave Rosenberg wrote:
Thanks Chris, but I have about 10 different fields and want to make sure none of those are the same. Dave Chris Wright wrote:With javascript onSubmit, but that ain't php, so with if($form1==$form2){sendthembackwitherrors()} ---