Ok, I've been teaching myself PHP and doing little projects for about 40 hours, and I would think I didn't muff up a simple IF statement, but.... The two echos below show the proper things (the password and the length of the password).
But, the echo with "ARGH" and the studentnotexist function gets called! I have no idea why. Sure it is something simple.
echo $password;
echo strlen($password);
if (strlen($password < 2)) {
echo "********************* ARGH ************************";
studentnotexist();
session_destroy();
die();
}
else
//Begin IF blocks that test various conditions for user name and password
if ($password != $passwordentered) { //if password is wrong
badpassword();
die();
}
You are checking the length of "$password < $2" not the length of "$password".
Observe the difference:
if (strlen($password < 2)) {
vs
if (strlen($password) < 2) {
Look at where the parentheses are.
You want the second one.
Watch out where you close the brackets:
if (strlen($password) < 2)