dmx1 Posted May 17, 2022 Share Posted May 17, 2022 Hi Larry, Hope you are well. If I am on the 'checkout.php' page, and then I go directly to the 'login.inc.php' page from the 'checkout.php' page, after I successfully log in, I want to go straight back to the 'checkout.php' page. I want to go directly back to the checkout.php from the 'login.inc.php' page, only after initially coming from the 'checkout.php page', and not from any other page. So whatever page I am on, and I go directly to the 'login.inc.php' from that page, I want to be redirected straight back to the previous page. I have tried to implement this, but I am not having much luck. PS: I am trying to include the login feature from exercise 1. Thank you. regards Link to comment Share on other sites More sharing options...
Larry Posted May 18, 2022 Share Posted May 18, 2022 Hey! First, just to be clear, you'd be going to the login.php page, not login.inc.php (which is an included file). In any case, to pull this off there are two options (off the top of my head): Use PHP to pass along the destination page. This would mean changing the login link so it adds ?dest=checkout to the URL (for the checkout page; for any other page you'd set this value accordingly). Then you'd update the login page so that on a successful login it redirects to that page. Use JavaScript to do a redirect to one page back in the history. The PHP route is better in my opinion, but requires a bit more programming effort. Link to comment Share on other sites More sharing options...
Recommended Posts