Forum Moderators: coopster
Can anyone possible help, this is driving me nuts :(
This form locks up (just hangs in the process if $errors isnt empty?
If there is no error detected it works fine
[PHP]if (isset($_POST['submit-form'])) { // Handle the form if its been posted
$errors = array(); // Initialize error array.
// validate first_name
if ((ctype_alpha($user) == FALSE ))
$errors[] = "Please enter an email account name that consists only of letters and numbers only.";
// validate password1
if ((ctype_alpha($password1) == FALSE ))
$errors[] = "Please enter a password that consists only of letters and numbers only.";
// validate password2
if ((ctype_alpha($password2) == FALSE ))
$errors[] = "Please enter a password that consists only of letters and numbers only.";
// Check for a password and match against the confirmed password.
if ($_POST['password1'] == $_POST['password2']) {
$p = ($_POST['password1']);
} else {
$errors[] = 'Your password did not match the confirmed password!';
}
if (empty($errors)) { // If everything went okay
// do something
} else { // if errors array contains a value
echo "<table align=\"center\"><tr><td>The following error(s) occurred:<br />";
foreach ($errors as $msg) { // Print each error.
echo "$msg<br />\n";
}
echo '</td></tr></table>';
} // End of if (empty($errors))
[/PHP]