Forum Moderators: coopster
javascript:history.back(). If I need to be 100% sure that the button will work I pass the referring page along in the URI. If you use sessions than just remember the last page in your session container and use that URI.
Andreas
if (isset($HTTP_REFERER)) {
echo "<a href='$HTTP_REFERER'>BACK</a>";
} else {
echo "<a href='javascript:history.back()'>BACK</a>";
}
That's my first guess at it. Probably wrong.
>>>do people not use the back button of their browser instead of clicking a link or button?
I think it helps keep the mouse in a closer proximity when surfing a thumbnail type setup. They don't have keep going back up to the browser.
$_SERVER['HTTP_REFERER'] superglobal just to be sure. Checking whether the referrer is a valid URI and on your domain might be a good idea as well. After all this could be anything1, so simply echoing it will open up your site to all kinds of code injections vulnerabilities. Andreas