Jump to content

Posting twice


The Little Guy

Recommended Posts

on the php/MySQL side, what actions do you take from preventing double posting?

 

Lets say a user fills out a form, then clicks the submit button. They wait and it takes 10 seconds and the didn't realize that it was still processing, so they click it again and finally the page reloads, but it added a duplicate record to the database.

 

How do you go about handling this so if the user clicks the button 2+ times, it only adds one record unless they fill the form again.

 

edit:

Duplicate records are fine, but we want to prevent double posting I know there is a JS way, but not everyone has JS enabled.

Link to comment
Share on other sites

I had always heard people say to use a form token and didn't know how to do it and for some reason never looked it up. I always assumed it would be more complicated but that is actually the easiest thing I've ever seen. I wasted so much time comparing the data being posted to existing data to check for a double submit that way. Thanks for the link KingPhillip.

 

Being lazy is hard work.

Link to comment
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.