如果空变成功,即使变量不为空

 if($yesorno == "NO") {
$status="error";
}elseif(empty($userid) || empty($password) || empty($charid) || empty($vault)) {
    echo "$userid
";
    echo "$password
";
    echo "$charid
";
    echo "$vault
";
$status="error";
}

It supposed to check if $userid, $password, $charid or $vault is empty, if they are, it's supposed to set $status to error. However, when these variables contain something it stills sets it to error. As you can see I tried adding so that it echoes every variable, and the output is the four different values.

Why isn't it skipping the echo if they are all not empty? I can post more code if you say what specifically, I am not sure what's relevant, except what I already posted.

Try this code:

   $yesorno = false;
    if(!$yesorno) {
        $status="error";
    }
    if(empty($userid) || empty($password) || empty($charid) || empty($vault)) {
        echo "$userid
";
        echo "$password
";
        echo "$charid
";
        echo "$vault
";
        $status="error";
    }