Jump to content

$_GET Menu with Second Variable ?


emcgfx

Recommended Posts

I'm using this menu now:

switch(safe($_GET['p'])) {
  // Navigation Menu // English
  case 'page1':
    $get = 'page1'; break;
  case 'admin':
    $get = 'admin'; break;
  default:
    $get = 'page1'; break;
} //menu switch

 

Then get pages with:

if (file_exists("$get.php")) {
  require_once(safe("$get.php"));
} else {
  echo 'sorry, not done yet ;-)';
}

 

This works perfectly: index.php?p=page1

 

I use clean urls, so I do this actually: http://domain.com/page1

 

What I want to do is something like this for example;

http://domain.com/admin/add

 

Where "add" is the function of admin page.

 

I can add this kind of switch to admin.php file and call it something like this: http://domain.com/admin&a=add

 

But I was wondering if there is better way to do this, any help would be awesome. Thank you guys.

Link to comment
https://forums.phpfreaks.com/topic/208063-_get-menu-with-second-variable/
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.