0

A web site I'm trying develop has several pages that won't open unless the user is logged in. If not logged in, the user is redirected to a login page that tells the user why they were reditrected.
Prior to the redirection, a SESSION variable stores the path back to the page the user was redirected from.
The user gets to login (user name & password), clicks 'Submit', gets a message that the login was valid.

Then if the user clicks the 'Return' button, I want him returned to the calling page, whichever one it was.

I have tried multitudes of keystrokes to try to make this work, too many to post them all but most are a variation of this:

<input type="submit" class="submit_button" value=" Back " onclick="location.href = <?php echo $linkback; ?> style="font-weight: 700" />

$linkback is the SESSION variable that was set previously pointing back to the calling page. The SESSION data is correct, there is no error, it just refreshes the login page.
Also, the 'Back' fucntion using 'history(-1)' doesn't work because the previous page is not n the history after the redirect to the login page.

Any help would be appreciated.

2
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by dougsix
0

your getting a js error because your link syntax is wrong

onclick="location.href = <?php echo $linkback; ?>
you need single quotes around the link and your missing the closing double quotes after onclick
onclick="location.href = '<?php echo $linkback; ?>'"
and the submit part of the button is firing causing you to submit your page back to its self

0

Exactly the help I needed!
The solution worked perfectly (after I corrected a typo) and resolved a problem I had been working on for many hours.

Thanks again.
Dougsix

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.