Listing 5.10. A sample process_form() Function
<?php function process_form($data) {
$msg = "The form at {$_SERVER['PHP_SELF']} was submitted with these values: \n\n"; foreach($data as $key=>$val) { $msg .= "$key => $val\n"; } mail("joeuser@somewhere.com", "form submission", $msg);
} ?>
Because the validate_form() function itself is best explained in conjunction with the other required functions, I will not attempt to explain the function further in text. Rather, see , which contains a fully commented validate_form() function as a part of the complete form-validation script:
Listing 5.11. The Complete Form Validation Script
|