kalster Posted November 30, 2014 Share Posted November 30, 2014 when the user clicks the submit button from a html form, it needs to go back two pages with that loaded page refreshed. for the javascript i only have history.go(-2); with php, I have tried cookies and sessions which i discovered that neither will work because the loaded page is not refreshed. I could do a html body onload but that would break the w3c validator. what are my options? Quote Link to comment https://forums.phpfreaks.com/topic/292794-go-back-2-pages-with-loaded-page-refreshed/ Share on other sites More sharing options...
Alex_ Posted November 30, 2014 Share Posted November 30, 2014 Sounds more like a Redirect to me. And if that's what it really is, then I'm not entirely sure why you're trying to use the browser's history for it. Assuming your form submits to some php script that updates the formentioned data displayed on the previous-previous page (-2), you can simply redirect back to that page upon finishing the update of data in the script. Or am I assuming wrong? Quote Link to comment https://forums.phpfreaks.com/topic/292794-go-back-2-pages-with-loaded-page-refreshed/#findComment-1498094 Share on other sites More sharing options...
kalster Posted November 30, 2014 Author Share Posted November 30, 2014 (edited) when the user clicks the submit button from the form, the next page loaded is a process page. after that page is finished, it then needs to go back two pages in history to get the page that was loaded before the form was loaded and that page can be different every time. Edited November 30, 2014 by kalster Quote Link to comment https://forums.phpfreaks.com/topic/292794-go-back-2-pages-with-loaded-page-refreshed/#findComment-1498128 Share on other sites More sharing options...
mac_gyver Posted December 1, 2014 Share Posted December 1, 2014 what are my options? just put your form and form processing on the same page. in this case the only redirecting you will need is one to the exact same url/page after you have processed the form data, to cause a get request for that same url/page to cause the browser to not try and submit the same post data again. Quote Link to comment https://forums.phpfreaks.com/topic/292794-go-back-2-pages-with-loaded-page-refreshed/#findComment-1498154 Share on other sites More sharing options...
Tom8001 Posted December 1, 2014 Share Posted December 1, 2014 not sure if this is any use but have you tried making a function? Example: <button onClick="HistoryBack()"> Label </button> function HistoryBack() { window.history.back(); } is that any use? Quote Link to comment https://forums.phpfreaks.com/topic/292794-go-back-2-pages-with-loaded-page-refreshed/#findComment-1498233 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.