i have a form with 'validation' on it. thing is it doesnt work at all. here is the code:
for($i=0;$i<count($required_fields);$i++) {
if(!isset($_POST[$required_fields[$i]]) || $_POST[$required_fields[$i]]=='') {
$err[$errCount]='You must provide a '.$_POST[$required_fields[$i]];
$errCount = $errCount + 1;
}else{
$field[$fineCount] = $_POST[$required_fields[$i]];
$fineCount = $fineCount + 1;
}
}
if ($errCount>0) {
//output error code
$strOut = "Your submision generated the following errors:<br>";
for ($i=0;$i<count($err);$i++){
$strOut .= $err[$i] . "<br>";
}
}else{ do whatever
- for($i=0;$i<count($required_fields);$i++) {
- if(!isset($_POST[$required_fields[$i]]) || $_POST[$required_fields[$i]]=='') {
- $err[$errCount]='You must provide a '.$_POST[$required_fields[$i]];
- $errCount = $errCount + 1;
- }else{
- $field[$fineCount] = $_POST[$required_fields[$i]];
- $fineCount = $fineCount + 1;
- }
- }
- if ($errCount>0) {
- //output error code
- $strOut = "Your submision generated the following errors:<br>";
- for ($i=0;$i<count($err);$i++){
- $strOut .= $err[$i] . "<br>";
- }
- }else{ do whatever
this code doesnt work. the page just hangs and doesnt refresh at all. anybody got any better suggestions?