// not what we expect. You will need an IF block for each element you will // check (see above section 1c and 1d). The if blocks should also be in the // order that the elements appear on your form so that the error messages // will be in the order they appear. errorMsg will be displayed on the form // see section 3b. The error flag ($emailERROR) will be used in section 3c. if ($startWeight == "") { $errorMsg[] = "Please enter your starting weight"; $startWeightERROR = true; } elseif (!verifyNumeric($startWeight)) { $errorMsg[] = "Your starting weight appears to be incorrect."; $startWeightERROR = true; } if ($goalWeight == "") { $errorMsg[] = "Please enter your goal weight"; $startWeightERROR = true; } elseif (!verifyNumeric($goalWeight)) { $errorMsg[] = "Your goal weight appears to be incorrect."; $goalWeightERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
$lastNameERROR = true; } elseif (!verifyAlphaNum($lastName)) { $errorMsg[] = "Your last name appears to have an extra character."; $lastNameERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your uvm affliated email address"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } if ($height == "") { $errorMsg[] = "Please enter your height (in numeric inches)"; $heightERROR = true; } elseif (!verifyNumeric($height)) { $errorMsg[] = "Your height appears to be incorrect. Make sure it is in numeric inches"; $heightERROR = true; } ?> <fieldset class="wrapper"> <legend>Join the Fit Family Today</legend> <fieldset class="form"> <legend>Please fill out the following registration form to become a member! (*Required)</legend> <fieldset class="contact"> <legend>*Contact Information</legend>
$townError = true; } if ($distance == "") { $errorMsg[] = "Please enter the town's distance from UVM."; $distanceError = true; } elseif (!verifyNumeric($distance)) { $errorMsg[] = "The value entered for the distance must be strictly numeric."; $distanceError = true; } // Location field can be blank if ($location != "" and !verifyAlphaNum($location)) { $errorMsg[] = "The location info appears to contain invalid characters."; $locationError = true; } // cost field can be blank if ($cost != "" and !verifyNumeric($cost)) { $errorMsg[] = "The cost must be a number."; $costError = true; } // URL field can be blank if ($url != "" and !filter_var($url, FILTER_VALIDATE_URL)) { $errorMsg[] = "The URL you've provided is invalid."; $urlError = true; } // Description field can be blank if ($comments != "" and !verifyAlphaNum($comments)) { $errorMsg[] = "Your comments contain invalid characters."; $commentsError = true; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% //