Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.