Hello Community,
I was just wondering why my password matching section ( } else if (!$password === $cPassword) { ) in the else if isn't working.
Whats happening is it is saying the passwords do match but they don't. I have tried many ways to fix it there is one way to possible fix it i could have it as a single if but i don't want alot of if statements.
The script i'm using is below.
if (isset($_POST['submit'])) {
if (isset($_POST['iAgree'])) {
if (isset($_POST['fullName']) && isset($_POST['username']) && isset($_POST['email']) && isset($_POST['sQuestion']) && isset($_POST['sAnswer']) && isset($_POST['password']) && isset($_POST['cPassword'])) {
$fullName = $_POST['fullName'];
$username = $_POST['username'];
$email = $_POST['email'];
$sQuestion = $_POST['sQuestion'];
$sAnswer = $_POST['sAnswer'];
$password = $_POST['password'];
$cPassword = $_POST['cPassword'];
if (strlen($username)<6) {
echo "The username length <font color='red'>must</font> be more than 6 characters.";
} else if (strlen($password)<6) {
echo "The password length <font color='red'>must</font> be more than 6 characters.";
} else if (preg_match("/[^a-zA-Z0-9\_\-]+/", $username)) {
echo "You username cannot contain any special characters.";
} else if (!$password === $cPassword) {
echo "Your passwords don't match!";
} else {
echo "Done";
}
}
else
echo "Please fill in <b>all</b> the fields!";
}
else
echo "You <font color='red'>must</font> agree to the terms!";
}
Please help...