Jump to content

php switch if isset


jwk811

Recommended Posts

i know theres a way but i just forget. i want to do a switch function.

 

switch ($_GET['page']) {
    case 0:
        include 'page';
        break;
    case 1:
        include 'page1';
        break;
    case 2:
        include 'page2';
        break;
    default:
        include 'page';
}
?>

 

just like that but if there is no $_GET page i just want it to do the default. instead of doing if isset GET page do switch else default page. i just want it to be simpler by doing something like switch(isset$_GET etc.

Link to comment
https://forums.phpfreaks.com/topic/235792-php-switch-if-isset/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.