Jump to content

Go Back Page Link


utkesmer
 Share

Recommended Posts

you can do it with javascript, if I'm correct. It involves using the browsers history (part of the DOM?) to determine where they've been.

Link to comment
Share on other sites

You could also do it with PHP by storing the last page you were on in a session variable and linking to that value/<a href="<?php echo $_SESSION["last-page"]; ?>">Go back</a>I like this approach because it works even if JavaScript is not enabled.

Edited by Sckewi
Link to comment
Share on other sites

You could also do it with PHP by storing the last page you were on in a session variable and linking to that value/<a href="<?php echo $_SESSION["last-page"]; ?>">Go back</a>I like this approach because it works even if JavaScript is not enabled.
Using the HTTP_REFERER header is probably better. That way it would work even if you got to the page through somewhere else.
<a href="<?php echo $_SERVER['HTTP_REFERER']; ?>">Go back</a>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...