KS3MAW Posted December 17, 2022 Share Posted December 17, 2022 Hello, Thanks for your help in advance. When some users use the Back button coded below the previous screen doesn't present the data it had when they went to it. Typically it's a list of classes assigned to that instructor. For this specific user it happens every time. But many if not most it functions correctly. Does anyone see anything wrong with the code? Or is there anything I can add to ensure it goes back correctly. Please forgive, I am new to PHP and this is inherited code from a much more experienced coder. <input type='button' value=' Back ' onclick='document.location.href="index.php?<?=($session["admin"]?($_REQUEST["my_courses"]?"my_courses=1":"admin_view=1&term=".$term):"")?>"' /> Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/ Share on other sites More sharing options...
KS3MAW Posted December 17, 2022 Author Share Posted December 17, 2022 submit_scores.txt Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603677 Share on other sites More sharing options...
requinix Posted December 18, 2022 Share Posted December 18, 2022 That's because your "back" button is not a back button. It's a link that takes the user to the URL of the previous page. Which, in all possibility, is not going to present them with the same information as it had when they left it. Question #1: Why do you have a back button at all? Question #2: Why aren't people using their own browser's back button? Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603679 Share on other sites More sharing options...
KS3MAW Posted December 19, 2022 Author Share Posted December 19, 2022 This application was written by a previous programmer. So, I don't know why. Would using the browser back button theoretically fix my issue? Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603724 Share on other sites More sharing options...
requinix Posted December 19, 2022 Share Posted December 19, 2022 Theoretically, sure. Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603725 Share on other sites More sharing options...
KS3MAW Posted December 19, 2022 Author Share Posted December 19, 2022 Well, it seems to work. They get an error message to retry and resend. But that is much better than forcing them to log out and then back in. We are getting rid of this app in a few months. SO as far as I and my boss are concerned, we're all good! THANK you so much!! Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603726 Share on other sites More sharing options...
requinix Posted December 20, 2022 Share Posted December 20, 2022 It may be possible to eliminate the resubmit warning too: by redirecting after a form submission to a reasonable page. That could be the same URL or a different one, point is that the page the user sees is from a normal GET request instead of displayed during their original POST request. It's called POST/Redirect/GET. Quote Link to comment https://forums.phpfreaks.com/topic/315659-back-button-doesnt-appear-to-be-working-correctly/#findComment-1603731 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.