kiowa_jackson Posted January 11, 2007 Share Posted January 11, 2007 Wow, just spent 10 mins trying to read the scrambled letters to register to post :PJust getting in to php but am familiar with the very basics...I want to know if there is a way to make php show different pages depending on what link someone comes in from?What I mean if there is a way to use the include() command display a variable that is controlled by the link to the page...so something like if someone clicks http://www.domain.com/index.php?a it takes them to an index site with one headline and if they click http://www.domain.com/index.php?b they get another.I know these aren't the correct, but I'm wondering if there is something that achieves something similar? Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 [code]<?php if (isset($_GET['page'])) { switch ($_GET['page']) { case 'news': include 'news.php'; break; case 'about': include 'about.php'; break; default: include 'index.php'; break; } }?>[/code]Then your links would look like... http://www.domain.com/index.php?page=news Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks man that helps Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted January 11, 2007 Author Share Posted January 11, 2007 The script works great, but when I use the standard link it defaults to nothing...it looks like this[code]<?php if (isset($_GET['page'])) { switch ($_GET['page']) { case 'panic': include 'panic.php'; break; case 'agoraphobia': include 'agoraphobia.php'; break; default: include 'panic.php'; break; } }?>[/code] but it won't default to panic.php when I use the regular link(but it works well with the modified links)...what am I doing wrong?Thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 11, 2007 Share Posted January 11, 2007 Try this:$page = $_GET['page'] switch ($page) { Quote Link to comment Share on other sites More sharing options...
trq Posted January 12, 2007 Share Posted January 12, 2007 [code]<?php if (isset($_GET['page'])) { switch ($_GET['page']) { case 'panic': include 'panic.php'; break; case 'agoraphobia': include 'agoraphobia.php'; break; default: include 'panic.php'; break; } } else { include 'panic.php'; }?>[/code] Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted January 12, 2007 Author Share Posted January 12, 2007 thanks, works now! 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.