schilly Posted June 11, 2010 Share Posted June 11, 2010 Every now and then we get duplicate orders through our ordering page. I'm just wondering what's the best way for detecting and stopping them. I do a redirect upon payment completion to a confirmation page to stop the person from reloading the browser and submitting the form data gain but they can easily go back and the browser will ask if they want to submit the form data again which they likely will. What's the best practise for this? I could ajax the form but I don't want to do that. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/ Share on other sites More sharing options...
premiso Posted June 11, 2010 Share Posted June 11, 2010 You can always set a session variable that is like "recently_submitted" which has some identifying information, IE the products or the total end cost. If they submit the same thing within x minutes, deny it. But if you do a proper redirect via header, this "should" wipe out the POST data if I recall. Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/#findComment-1070833 Share on other sites More sharing options...
schilly Posted June 11, 2010 Author Share Posted June 11, 2010 hmmm ya maybe a session var with the total in it and a timestamp. i think that would work. i do a header redirect to the completion page but i'm pretty sure if you go back in the browser it will prompt to resubmit the form. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/#findComment-1070837 Share on other sites More sharing options...
schilly Posted June 11, 2010 Author Share Posted June 11, 2010 this looks pretty good too. http://phpsense.com/php/prevent-duplicate-form-submission.html Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/#findComment-1070841 Share on other sites More sharing options...
ignace Posted June 11, 2010 Share Posted June 11, 2010 http://en.wikipedia.org/wiki/Post/Redirect/Get Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/#findComment-1070858 Share on other sites More sharing options...
schilly Posted June 11, 2010 Author Share Posted June 11, 2010 http://en.wikipedia.org/wiki/Post/Redirect/Get Ya that's what I'm running right now. Quote Link to comment https://forums.phpfreaks.com/topic/204498-best-practises-for-stopping-multiple-form-submissions/#findComment-1070863 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.