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? 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) 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(); 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! 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
Archived
This topic is now archived and is closed to further replies.