[SOLVED] Get not Getting (or request/post )

The following code is not behaving as should (I think)

[php]
$l = 1;
if(!isset($_GET))
{
foreach($menu[‘login’] as $line => $menu)
{
$l++; if ($l > 2) $l = 1;
echo ‘

  • ’.$menu.’
  • ’;
    }
    }
    elseif(isset($_GET))
    {
    foreach($menu[key($_GET)] as $line => $menu)
    {
    $l++; if ($l > 2) $l = 1;
    echo ‘
  • ’.$menu.’
  • ’;
    }
    }
    [/php]

    When the app is executed, its erroring out on the “else” section, when there is NO get set, or request, or post(I tried all 3). The else should not trigger. Can someone tell me why it might be ?

    fixed my own issue LOL.
    OK, instead of doing “isset” (which i believe that might have been incorrect form), I went with “empty”. This produced the desired result.

    from this:
    [php]if(!isset($_GET))[/php]

    to this:
    [php]if(empty($_GET))[/php]

    The first one is saying that if it is NOT set then perform the true portion of the if statement and that is usually what a person doesn’t want to do. The second if statement the the empty statement baffles me why it’s working for you, but I don’t know what you’re trying to do. Why you are using a $_GET statement without an argument (Variable)? The whole script doesn’t make much sense to me, but I guess if it’s working that is all that matters. :wink: :-\

    its a fresh page, so nothing was done at the time.

    I was using get, and when it is empty, it will go to the login screen as nothing is being done (ergo why the get is empty), however when get is set and has a variable, it will branch off elsewhere. This is where the bug came in.
    Apparently that should have worked, as if get is not set, it should not have went to the else statement but it did.
    but definition of insanity is repeating the same thing over and over expecting different results, I traded up, and tried “empty” - why that worked and !isset FAILED, is a mystery.

    Sponsor our Newsletter | Privacy Policy | Terms of Service