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 Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/ 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 Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158023 Share on other sites More sharing options...
kiowa_jackson Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks man that helps Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158026 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 Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158734 Share on other sites More sharing options...
Jessica Posted January 11, 2007 Share Posted January 11, 2007 Try this:$page = $_GET['page'] switch ($page) { Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158736 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] Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158772 Share on other sites More sharing options...
kiowa_jackson Posted January 12, 2007 Author Share Posted January 12, 2007 thanks, works now! Link to comment https://forums.phpfreaks.com/topic/33698-alternate-links/#findComment-158794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.