I am trying to create a button that knows what page you came from and enters that value into the anchor tag. Does anyone know a solution using either jQuery or PHP or both?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In PHP, you could keep track of the last page the user was on by using
$_SERVER['REQUEST_URI'];and storing it in the session.
and run it after your html for the current page is rendered, then in a link you could have something like this
<a href="<?php echo $_SESSION['last_page']; ?>">Back</a>