leachus2002 Posted December 1, 2010 Share Posted December 1, 2010 Hi All, Is there any way that PHP can detect if a page has been refreshed? Basically I have a form that when submitted, inserts a row in to a database, but I am finding that when I refresh the page, it repeats the insert statement. Any ideas? Thanks Matt Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/ Share on other sites More sharing options...
litebearer Posted December 1, 2010 Share Posted December 1, 2010 Use INSERT IGNORE rather than INSERT. If a record doesn't duplicate an existing record, MySQL inserts it as usual. If the record is a duplicate, the IGNORE keyword tells MySQL to discard it silently without generating an error. Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141779 Share on other sites More sharing options...
leachus2002 Posted December 1, 2010 Author Share Posted December 1, 2010 Hi There, Unfortunately, this didnt work. Could this be cause I am using an identity column, thus not making the columns identical? Cheers Matt Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141783 Share on other sites More sharing options...
dragon_sa Posted December 1, 2010 Share Posted December 1, 2010 you could possible process the form on a seperate page then use the header function to return to your form Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141788 Share on other sites More sharing options...
redfort Posted December 1, 2010 Share Posted December 1, 2010 use some paramters to identify the submit and refresh ......it works............ Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141789 Share on other sites More sharing options...
leachus2002 Posted December 1, 2010 Author Share Posted December 1, 2010 Like the submit param's - can anyone prompt my memory? Thanks Matt Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141791 Share on other sites More sharing options...
litebearer Posted December 1, 2010 Share Posted December 1, 2010 Could this be cause I am using an identity column, thus not making the columns identical? Please show your code and db structure Link to comment https://forums.phpfreaks.com/topic/220339-stop-re-submit-on-form-on-page-refresh/#findComment-1141794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.