the "Go to previous URL (if it exists)" option is triggered by sending the path to the previous page through a querystring variable named "accesscheck", for example, if I try to access a protected page, I get redirected to the login page with a URL looking like:
login.php?accesscheck=%2Fps_4_5%2Fadmin%2Fhome.php%3F
this tells the login behavior to redirect me back to
home.php
on successful login. For this to work, however, the querystring must be passed when the login form posts. make sure the foloowing coded is used for the forms action:
<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>
for example, the login for tag should look like:
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="WAATKLogInForm" id="WAATKLogInForm">