Jump to content

ISSET $_GET NOT WORKING


Gayner

Recommended Posts

because isset() checks to see if that variable is set.

 

So, if $_GET['God'] is set, then isset($_GET['God']) will translate to "true" but it won't give you the value of $_GET['God']

 

if you want to check to make sure $_GET['God'] is not only set, but set to something specific, use:

if ($isset($_GET['God']) && $_GET['God'] == "Enter")

 

so it checks to see if $_GET['God'] is set at all, and if it is (only if it is) it will then check the value.

Link to comment
Share on other sites

because isset() checks to see if that variable is set.

 

So, if $_GET['God'] is set, then isset($_GET['God']) will translate to "true" but it won't give you the value of $_GET['God']

 

if you want to check to make sure $_GET['God'] is not only set, but set to something specific, use:

if ($isset($_GET['God']) && $_GET['God'] == "Enter")

 

so it checks to see if $_GET['God'] is set at all, and if it is (only if it is) it will then check the value.

 

 

oh, lol

 

ok thanks so i'll add the &&

 

wat about a | will that work too ?

Link to comment
Share on other sites

wat about a | will that work too ?

 

|| means OR.

 

You'd use it like so:

 

<?php

if ($my_mom == "ghetto" || $my_mom == "white trash")) {
    // if my mom is ghetto or white trash...
    $i = "cannot spell which is why I say 'wat'";
}
?>

Link to comment
Share on other sites

Gayner something else you do to make sure that $god is  set before calling it. Welcome to the wonderful ternary operator.

 

<?php
// make $god equal $_GET['god'] if its set else make it empty ""
  $god = isset($_GET['god']) === true ? $_GET['god'] : "";
// you could add some filtering right there also
// $god = isset($_GET['god']) === true ? mysql_real_escape_string(strip_tags($_GET['god'])) : "";

  if($god == "Enter"){

   // stuff

  }

 

Link to comment
Share on other sites

Gayner something else you do to make sure that $god is  set before calling it. Welcome to the wonderful ternary operator.

 

<?php
// make $god equal $_GET['god'] if its set else make it empty ""
  $god = isset($_GET['god'] === true ? $_GET['god'] : "";
// you could add some filtering right there also
// $god = isset($_GET['god'] === true ? mysql_real_escape_string(strip_tags($_GET['god'])) : "";

  if($god == "Enter"){

   // stuff

  }

 

Thanks so much code for such little code i want to do, but i guess that's php, i love the terny operator tho thx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.