aashcool198 Posted June 10, 2009 Share Posted June 10, 2009 Hi.. i have created a form. which is having only one field. when user clicks on submit the data is inserted in database. The problem is if the user clicks back-button of browser the data is resubmitted and is stored again in database. How can i prevent this? Quote Link to comment https://forums.phpfreaks.com/topic/161696-solved-prevent-unwanted-inserting-in-database/ Share on other sites More sharing options...
rivan Posted June 10, 2009 Share Posted June 10, 2009 You can redirect user after inserting data into db (that way refreshes of that page won't insert any new data) Quote Link to comment https://forums.phpfreaks.com/topic/161696-solved-prevent-unwanted-inserting-in-database/#findComment-853264 Share on other sites More sharing options...
joshgarrod Posted June 10, 2009 Share Posted June 10, 2009 You can redirect user after inserting data into db (that way refreshes of that page won't insert any new data) Using the following code: header("location:my_redirect_page.php"); exit(); Quote Link to comment https://forums.phpfreaks.com/topic/161696-solved-prevent-unwanted-inserting-in-database/#findComment-853284 Share on other sites More sharing options...
aashcool198 Posted June 11, 2009 Author Share Posted June 11, 2009 thanks... its done! Quote Link to comment https://forums.phpfreaks.com/topic/161696-solved-prevent-unwanted-inserting-in-database/#findComment-853567 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.