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? Quote Link to comment 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] Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
marcus Posted December 5, 2006 Share Posted December 5, 2006 No problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.