PHP parameter without value using for navigation

Posted by somewalri on Stack Overflow See other posts from Stack Overflow or by somewalri
Published on 2010-12-24T19:38:59Z Indexed on 2010/12/24 19:54 UTC
Read the original article Hit count: 115

Filed under:
|
|
|

Hello,

I am trying to set up a navigation system that uses GET parameters with no value, example:

http://foo.bar/?mainPage takes the visitor to the main page.

So I am using if statements and I am wondering if there is a way I can do this without a bunch of if statements? I don't think switch statements would work for this. This is currently what I have:

$mainPage = $_GET['mainPage'];
$contact = $_GET['contact'];

if(isset($mainPage)) {
    // go to main page
}

if(isset($contact)) {
   // go to contact page
}

I don't want to have to end up writing a ton of if statements, though. Any ideas?

Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about parameters