Forum Moderators: DixonJones

Message Too Old, No Replies

Previous page

Storing previous page

         

renos

9:20 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



Hi i was wondering if it is possible to store the url of the previous page of the user. Then call this information and send it to myself once the user presses a submit button.

The idea is that i know were my user has come from only if they press the submit button on my form i.e to request more information.

Iguana

9:25 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Referer column in the logs?

Dijkgraaf

9:59 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can try using the referer, however this is unreliable as more and more often this is blocked by proxies or security software.

A bit more reliable in some cases is to use a cookie, again not 100% reliable as some users block cookies.

If you reliably want to find out from which page they came, you will have to have it as a parameter in the query string.
e.g. all links to your query page would have
?frompage=pageid it, where pageid would be a identifier of the page.

renos

12:28 pm on Feb 10, 2006 (gmt 0)

10+ Year Member



Is there an example script that i can see it would be a great help thanx.

Dijkgraaf

7:05 pm on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What scripting language do you have access to/are you familiar with?

For example if you have page1.php have a link
<a href="page2.php?page=page1">
Then in the code of page2 with PHP you would have
$previouspage=$_GET['page']

If you wanted to try and use the referer in PHP it would be
$referer = $_SERVER['HTTP_REFERER'];

renos

8:13 pm on Feb 12, 2006 (gmt 0)

10+ Year Member



I am more comfertable with javascript but if i had a working example it would help. Thanx for your help