Alright, so I am working on this new site and for the registration, I am using a template I have used plenty of times in the past. Now, this one snippet I am showing you will check if the username is either too short or too long, or if the password fields do not match. Those are the parts that don't work. Notice how for each thing it appends more data on to the errorMsg variable.
It works for checking if the username/email is inside the database, but not for username length and password match.
if ((!$username) || (!$email) || (!$pass1) || (!$pass2)) {
$errorMsg .= "Please check the following:";
if (!$username) {
$errorMsg .= "<li>Please fill in your Username</li>";
}
if (!$email) {
$errorMsg .= "<li>Please fill in your Email</li>";
}
} else if ($pass1 != $pass2) {
$errorMsg .= "<li>Your Password fields below do not match</li>";
} else if (strlen($username) < 4) {
$errorMsg .= "<li>Your username is too short. 4 - 20 characters please</li>";
} else if (strlen($username) > 20) {
$errorMsg .= "<li>Your username is too long. 4 - 20 characters please</li>";
} else if ($uname_check > 0){
$errorMsg .= "<li>username in use</li>";
} else if ($email_check > 0){
$errorMsg .= "<li>email address in use</li>";
} else { // Error handling is ended, process the data and add member to database
just want to know why the $pass1 != $pass2, strlen($username) < 4, and strlen($username) > 20 don't show up. I believe it is detecting the issue because it states "Please check the following:", but not the error.