Jump to content

Recommended Posts

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 :D

 

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.

Link to comment
https://forums.phpfreaks.com/topic/138423-simple-url-variable/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723755
Share on other sites

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? 

Link to comment
https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723756
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723761
Share on other sites

 

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>";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/138423-simple-url-variable/#findComment-723804
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.