soopafly Posted December 5, 2006 Share Posted December 5, 2006 Hi all!I've been out of the developing scene for quite a while now and have a very n00by question. Sorry if I'm not using the correct terminology as well :PI'm developing a very simple page. Let's just say I want to have a homepage, and a contact page, but I want to use one php file.Here's my situation:- File is called "index.php"- User clicks a link of "index.php?page=contact" on the homepage which takes them to the contact pageHere's what the PHP part looks like in my index.php:[code]<?phpif ($page==contact) { echo "Contact me here!";} else { echo "Here is my homepage";}?> [/code]When I test the site, the page goes straight to the homepage, even when I have "index.php?page=contact" in the URL. Help? Link to comment https://forums.phpfreaks.com/topic/29588-querystring-in-url-not-working/ Share on other sites More sharing options...
marcus Posted December 5, 2006 Share Posted December 5, 2006 [code]<?php$page = $_GET['page'];if($page == contact){echo "contact page";}else {echo "homepage";//or you can redirect it//header("Location: index.php?page=home");};?>[/code] Link to comment https://forums.phpfreaks.com/topic/29588-querystring-in-url-not-working/#findComment-135764 Share on other sites More sharing options...
soopafly Posted December 5, 2006 Author Share Posted December 5, 2006 [quote author=mgallforever link=topic=117491.msg479368#msg479368 date=1165361341][code]<?php$page = $_GET['page'];if($page == contact){echo "contact page";}else {echo "homepage";//or you can redirect it//header("Location: index.php?page=home");};?>[/code][/quote]That did it! Thank you SO MUCH! Link to comment https://forums.phpfreaks.com/topic/29588-querystring-in-url-not-working/#findComment-135775 Share on other sites More sharing options...
marcus Posted December 5, 2006 Share Posted December 5, 2006 No problem. Link to comment https://forums.phpfreaks.com/topic/29588-querystring-in-url-not-working/#findComment-135776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.