this is a little trickier.
make sure the register link passes the same qs variable:
<a href="register.php?accesscheck=<?php echo(urlencode($_SERVER['PHP_SELF'])); ?>">Log in</a>
on the registration page, make sure the forms action is set to pass any qs variables passed in:
action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>"
and that the redirect to the login page also passes the query string variables, in the insert record behavior, set the redirect to:
login.php<?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>