Reputation: 9
I am working on something, but with my if statements, it will say "test" no matter what, not following the other if statements. Help please, heres my code:
<?php
$userr = $_POST['user'];
$user = ucwords($userr);
$pass = $_POST['pass'];
if ($submit)
{
if ($userr && $pass)
{
if ($user == "Admin" && $pass == "password")
{
echo "Logged in";
}
else
{
echo "Fill in all fields";
}
}
else
{
echo "Submit!";
}
}
else
{
echo "test";
}
?>
Upvotes: 1
Views: 53
Reputation: 174957
That's most likely because $submit
always evaluates to false
.
Make sure that $submit
is defined and is what you expect it to be.
Also, if $user == 'false'
your script will break without warning.
Upvotes: 0
Reputation: 80639
Where are initializing your $submit
?
By a look at your code, I think you need:
$submit = $_POST['submit'];
Upvotes: 1