I have the weirdest problem I cannot figure out, see the following code:
$frmUsername = $_POST['frmUsername'];
$frmPassword = $_POST['frmPassword'];
if($frmUsername == "" || $frmPassword == "") {
print "frmUsername: " . $frmUsername;
print "frmPassword: " . $frmPassword;
} exit();
The result will be:
frmUsername: frmPassword:
But if I do the same thing and move the print statements outside of the IF:
$frmUsername = $_POST['frmUsername'];
$frmPassword = $_POST['frmPassword'];
print "frmUsername: " . $frmUsername;
print "frmPassword: " . $frmPassword;
if($frmUsername == "" || $frmPassword == "") {
} exit();
The result will be:
frmUsername: MYUSERNAMEfrmPassword: MYPASSWORD
So, why is the IF statement thinking frmUsername and frmPassword are blank, event when they're not, example:
$frmUsername = $_POST['frmUsername'];
$frmPassword = $_POST['frmPassword'];
if($frmUsername == "" || $frmPassword == "") {
print "I think the strings are empty, even when they're not";
} exit();
The result will be:
I think the strings are empty, even when they're not
Second example:
$frmUsername = $_POST['frmUsername'];
$frmPassword = $_POST['frmPassword'];
if($frmUsername == "" || $frmPassword == "") {
print "I think the strings are empty, even when they're not: '$frmUsername' '$frmPassword'";
exit();
}
The result will be:
I think the strings are empty, even when they're not: '' ''