tags:

views:

58

answers:

1

How do I set up a hyperlink on my page that will recognize a landing page from another source (web page) and change my link destination temporarily?

In other words:

Page one. Someone clicks a link on page (1) and it brings them to my page. On my page there is a link that goes to another page specifically a sign up page. I want my page to recognize the senders page and link and change my link so that it goes to their desired destination page.

Please help if you can or suggest a where to look site. Sorry if I am not using the right words to describe my problem, I'm still learning HTML.

+1  A: 

If I understand your question correctly, you want the HTTP_REFERER variable (in PHP: $_SERVER['HTTP_REFERER'].

This will give you the page that the user came from, and you can then use that to decide what link to give to the user. Note that it's easy to fake or remove, so you can't rely on it too much. It's the only way to find out which page (from another site) the user came from, though.

Edit: It's unclear from the question whether you have control of the links that are pointing to your website. If you do, then just have them add a referrer code to the end of the URL, like this: http://www.example.com/page.php?referrer=foo

You can then use that variable to identify them, for example in PHP:

if ($_REQUEST['referrer'] == 'foo') { ... }
MrZebra
The inbound pages could identify themselves. I get the feeling he is describing an affiliate system or something
MrChrister
I got the impression that he could not modify the inbound links. If he can, then yes, adding a ?referrer=foo to the URL is certainly the solution.
MrZebra
Actually, I'll edit the post to reflect this.
MrZebra
I don't really remember using php or a referrer code. I wrote it out again so that I might be more clear on what I am talking about please note my new question
Bobby Morris