Hyperlink issues

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

In other words:

Page one. Someone clicks a link on page (1) and it takes them to my page. There is a link on my page that goes to another page, specifically to the registration page. I want my page to recognize the senders page and link and change my link so that it navigates to the desired destination page.

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

+1


source to share


1 answer


If I understand your question, you need a variable HTTP_REFERER

(in the PHP: $_SERVER['HTTP_REFERER']

.

This will give you the page the user came from, and then you can use that to decide which link to give the user. Note that this is easy to fake or remove, so you cannot rely on it too much. This is the only way to know from which page (from another site) the user came from.

Edit . It's unclear if you have control over the links pointing to your site. If you do, just add the referrer code to the end of the url, like this:http://www.example.com/page.php?referrer=foo



Then you can use this variable to identify them, for example in PHP:

if ($_REQUEST['referrer'] == 'foo') { ... }

      

+1


source







All Articles