Forum Moderators: coopster
let's say I have a mutli-page form. I use functions to validate each form field individually.
So I have:
foreach ($_REQUEST as $Key => $Value){
($Key === "surname")? $surname = check_surname($_REQUEST['surname']) : '';
($Key === "name")? $name = check_name($_REQUEST['name']) : '';
...
}
?>
in the functions I assign the value of the request to a session if it validates (to carry it across the form pages) and unset the session if it doesn't validate (in case it's ok before and then changed).
If all the form field have a corresponding session my form was correctly field so I move on tho the next step.
What strikes me is that you seem to have a bunch of functions that will be used only once, such as check_name. That creates unnecessary extra server load. Why not do the validation and the assignment to session variables in the foreach-loop?