norse Posted April 13, 2006 Share Posted April 13, 2006 Ok this is really a n00b question but i know the answer would be quite easy. But ive tried to google it read some books but no exact explanation and implementation on this one.Ok here is the problem.I have a website and some links like About Us | Contact Us | Home ---> I want to appear in the address bar like index.php?dpage=1 for aboutus and index.php?dpage=2 for contactusI know ?dpage would be a variable, but can anyone point me in the correct path on how to implement this kind of navigation. If you can post the exact file structure on this one that would be of great help. Thanks Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/ Share on other sites More sharing options...
didier101 Posted April 13, 2006 Share Posted April 13, 2006 The var in you string would be fetched by $_GET [code]<?phpswitch ($_GET['dpage']) { case 1: header('Location: about_us.php'); break; case 2: header('Location: contact_us.php'); break; default: header('Location: index.php');}[/code] Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/#findComment-26482 Share on other sites More sharing options...
norse Posted April 13, 2006 Author Share Posted April 13, 2006 Yeah thats what im thinking of switch function. But where will i place the switch condition? each of the page? or just in the index file?. Its really helpful mate at least I understand Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/#findComment-26489 Share on other sites More sharing options...
didier101 Posted April 13, 2006 Share Posted April 13, 2006 Yeah, put it on your index.php page. So if you want to write an anchor, pointing towards contact.php, you would say index.php?dpage=6 - Then 6 points to contact.php on you index's switch condition. Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/#findComment-26497 Share on other sites More sharing options...
norse Posted April 13, 2006 Author Share Posted April 13, 2006 thanks mate its really been a great help. Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/#findComment-26503 Share on other sites More sharing options...
norse Posted April 13, 2006 Author Share Posted April 13, 2006 it seems to be working fine but the problem is that its not showing up the index.php file when i pull up index.php its not showing up. and one more thing mate. its not showing in the address bar like index.php?dpage=1 or index.php?dpage=2 i want to show it in the address bar. can you please check this one out Link to comment https://forums.phpfreaks.com/topic/7281-php-navigation/#findComment-26507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.