简体   繁体   中英

wamp server in green. $HTTP_GET_VARS and $_GET no found

I have a wamp server in green. PHP code found but $HTTP_GET_VARS and $_GET no found.

The page have this URL:

http://localhost/workfis/login.php?errorUsuario=vacio

The page have this code:

$variable1=$_GET['errorUsuario']=="vacio";
echo $variable1;
$variable2=$HTTP_GET_VARS['errorUsuario']=="vacio";
echo $variable2;

variable1 and variable2 dont print.

It looks like you're trying to assign the variable and compare it in the same statement. It will help to separate the two statements like so:

if(isset($_GET["errorUsuario"])){  // ensures value is set

    $variable1=$_GET['errorUsuario'];  // use = to assign a value

    if ($variable1 == "vacio"){       // use == to compare two values (returns true or false)
        echo $variable1;  // this will only print if the value is "vacio"
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM