1. Add to functions.php and create a slightly more advanced error system:
$GLOBALS['fail_msg'] = '';
function failed($string) { $GLOBALS['fail_msg'] = $string; }
function get_error() { return $GLOBALS['fail_msg']; }
2. In your main PHP file, since you've already included functions.php, you change the error output to:
<tr><td colspan="2">Sorry the following errors were found<br /> in your form: <p><font color=red size=1><i><?php echo get_error(); ?></i></font></p></td></tr>
3. Lastly, change your process.php error checking section to:
if(isset($_POST['submit']))// only do this if submit has been pressed, thus error messages will not show before hitting signup for first time
{
$GLOBALS['fail_msg'] .= validate_forename($forename);
$GLOBALS['fail_msg'] .= validate_surname($surname);
$GLOBALS['fail_msg'] .= validate_password($password);
$GLOBALS['fail_msg'] .= validate_age($age);
$GLOBALS['fail_msg'] .= validate_email($email);
}
And that should fix the problem of $fail not working.

New Topic/Question
Reply





MultiQuote




|