I have tried using this as an if statement, but it wont work. It says incorrect pass and wrong stuff. What is wrong?
$status = $_POST['status'];
$server = $_POST['server'];
$room = $_POST['room'];
$password = $_POST['password'];
$submit = $_POST['submit'];
if ($submit) {
if ($server && $status && $room && $password) {
if ($password == "o") {
echo "Done";
} else {
echo "all fields";
}
} else {
}
echo "incorrect pass";
} else {
echo "submit";
}
It’s a little difficult to see what you’re trying to do.
That should be inside the braces for one. This should stress the importance of proper code formatting and indentation.
I think it should also be switched with the other else block, like so:
Another thing, I always use
isset()to check if the$_POSTvalues are, in fact, set.