Jump to content

Double Posting


deansatch

Recommended Posts

Sometimes, on a slow connection, if someone clicks on a submit button, it inserts the info into the db but as the page is still showing the submit button, the impatient user has another angry click and it inserts the data again before resolving to the thankyou page.

 

Is there a way to stop this happening?

 

And on a similar note, when you have a page with a form on that posts to itself e.g. action="", how can I make it so that refreshing the page doesn't repost?

Link to comment
https://forums.phpfreaks.com/topic/171007-double-posting/
Share on other sites

It depends. If each of your posts are different from one another, you can do a check to make sure that the data isn't the same before posting it. If not, you can have a column in the array that logs the IP, and check if the IP has submitted data before on that table.

 

You could also check if the very last row submitted is the same as the row thats about to be submit, and exit the script if they are the same

Link to comment
https://forums.phpfreaks.com/topic/171007-double-posting/#findComment-901911
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.