PcGeniusProductions Posted December 26, 2008 Share Posted December 26, 2008 Hi. i am trying to get my PHP file to do this... file.php?content1 file.php?content2 file.php?content3 and it uses a different header redirect for each one. header('location:page1.php'); header('location:page2.php'); header('location:page3.php'); I hope this makes sense I am the ultimate novice at PHP, and do not know where to go for help on anything like this. I have had experience with redirecting a iFrame using this method, (file.php?frame=page2) but not changing the output itself. I will be grateful for any help offered. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/ Share on other sites More sharing options...
.josh Posted December 26, 2008 Share Posted December 26, 2008 page1.php <?php echo "<a href='page2.php?varname=somevalue'>page2</a>"; ?> page2.php <?php if ($_GET['varname']) { echo $_GET['varname']; // output: somevalue } ?> Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723752 Share on other sites More sharing options...
PcGeniusProductions Posted December 26, 2008 Author Share Posted December 26, 2008 Hi. this work, but not in the way I meant... Here it is in more detail... file.php?user=john This would go to google.com file.php?user=harry This would go to yahoo.com file.php?user=charlie This would go to msn.com Sorry for my lack of detail. Thanks for your quick reply, nevertheless. I am currently looking through a phpg uide on google, but it does not tell me anything about this :S Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723755 Share on other sites More sharing options...
.josh Posted December 26, 2008 Share Posted December 26, 2008 so...you want to make links that pass a name to another page, and based on the name, have that other page use a header to forward them to another page? Why the extra step? Just make the links on the first page point to the target pages in the first place. Or are you still not being clear enough? Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723756 Share on other sites More sharing options...
PcGeniusProductions Posted December 26, 2008 Author Share Posted December 26, 2008 Hi. Let me give a full structural overview of my idea... No, I realize this is by no means the most efficient way of doing things, but they strap in with other, future plans so here goes... There are 6 of us maintain a website, with me in the lead. What I want to do, is as each of my staff members to change their home-page to the main link, plus their name variable. For instance, Danny would change his homepage to: http://example.com/page.php?danny Mark would change his homepage to: http://example.com/page.php?mark If a user simply typed: http://example.com/page.php they would come to a stand-still (blank page) But, when the variable is entered, it then calls a pre-defined "header" statement related to that particular URL-Variable. And the idea being is that when a problem arises when we are out of contact, I can instantly change their homepage to the area they need to be in. There is not central page to link from, their browser "is" the centre. I hope this answer all questions. I am pretty sure there is no other details to add. Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723761 Share on other sites More sharing options...
redarrow Posted December 26, 2008 Share Posted December 26, 2008 normal way, your way imposable <?php if($_GET['username']){ echo "Member ".$_GET['username']." member page!"; exit; }else{}; $n=array("john","tom","mark","petter","paul"); foreach($n as $username){ echo"<br><a href='".$_SERVER['PHP_SELF']."?username=$username'>Memneber $username</a><br>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723804 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.