poleposters Posted October 9, 2008 Share Posted October 9, 2008 Hi, I have a search form. Once I submit a query and open a search result, if I click the browser back button. An alert pops up telling me To display this page, the application must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. This is pretty useful to stop record duplication if I'm submitting a form that inserts data into my database. But my users will find it pretty irritating. Is there any way to stop this? Or is it possible something in my script forces this to occur(I'll be happy to post some code, but its a pretty general search form) Link to comment https://forums.phpfreaks.com/topic/127665-solved-how-do-i-stop-the-resend-information-dialog-when-i-submit-a-search-form/ Share on other sites More sharing options...
Prismatic Posted October 9, 2008 Share Posted October 9, 2008 use get Link to comment https://forums.phpfreaks.com/topic/127665-solved-how-do-i-stop-the-resend-information-dialog-when-i-submit-a-search-form/#findComment-660704 Share on other sites More sharing options...
unkwntech Posted October 9, 2008 Share Posted October 9, 2008 No there is not, unless you submit the form with a JavaScript/Ajax call. Link to comment https://forums.phpfreaks.com/topic/127665-solved-how-do-i-stop-the-resend-information-dialog-when-i-submit-a-search-form/#findComment-660708 Share on other sites More sharing options...
poleposters Posted October 9, 2008 Author Share Posted October 9, 2008 Of course! Thank you. Get works great. I completely missed it! Link to comment https://forums.phpfreaks.com/topic/127665-solved-how-do-i-stop-the-resend-information-dialog-when-i-submit-a-search-form/#findComment-660733 Share on other sites More sharing options...
PFMaBiSmAd Posted October 9, 2008 Share Posted October 9, 2008 There is a way using post as well. You must submit to an intermediate page that saves any post/get/files data in a session and then this intermediate page redirects to the actual form processing page. By doing this, the back button skips over the intermediate page and goes back to the form page. Since you never go back to the intermediate page, which was the target of the action="..." parameter of the form, the browser does not attempt to resubmit the form data. If you use this method and you make your form and form processing code on the same page, the back button will actually take you to the page you were on before you got to the form. This could take you off the site. To solve this, add a dummy GET parameter to the end of the URL when the intermediate page redirects to the actual form processing code. By doing this the URL of the form and the URL of the form processing page is different (even if it is the same page) and the back button will take you back to the form and not to the page you were on before you first got to the form. Link to comment https://forums.phpfreaks.com/topic/127665-solved-how-do-i-stop-the-resend-information-dialog-when-i-submit-a-search-form/#findComment-660739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.