简体   繁体   中英

PHP $_REQUEST error

For some reason my $_REQUEST variable does not get the information I need it to get, this is the code I have got.

<?php
  if($_REQUEST["join"] != null){
      echo "Activated.";
  }
?>
<a href="?join=1">Join</a>

but for some reason this does not work, the page never echos Activated.

Try this

if(isset($_REQUEST["join"]))
{

    echo "Activated.";

}

?>
<a href="?join=1">Join</a>

First time it willn't print echo because server didn't get any $_REQUEST . But after click on join it will print the echo string. That $_REQUEST was undefined. so use isset that server will check is the $_REQUEST set or not and wouldn't print any warring.

Use Isset

<?php
  if(isset($_REQUEST["join"])){
      echo "Activated.";
  }
?>

<a href="?join=1">Join</a>

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