PHP If-Statements不起作用

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.

} else {

}
echo "incorrect pass";

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:

if ($server && $status && $room && $password) {
    if ($password == "o") {
        echo "Done";
    } else {
        echo "incorrect pass";
    }
} else {
    echo "all fields";
}

Another thing, I always use isset() to check if the $_POST values are, in fact, set.

This can't be valid code, you have more }s than {s.

Assuming there are a few conditions about that code that account for the brace mismatch, your

echo "incorrect pass";

happens after the closing brace of the 'if ($submit) {condition, and therefor will run *regardless* of the value of$submit`.