Grasper
Grasper

Reputation: 1313

PHP avoid duplicates caused by long load

I have a site where you can submit data into the db. Everything works fine but sometimes when I click to submit it takes long time. I noticed that some people try to click submit a couple of times while it is still loading and this way they insert the same entry more times in the database.

What is the solution for this problem?

Upvotes: 1

Views: 57

Answers (1)

jantimon
jantimon

Reputation: 38160

You can disable the button after the user submitted the form.

Here is a SO question/answer whith an example:
Disable button after submit with jQuery

If you don't use jQuery already you might use a vanilla js solution instead.

Upvotes: 2

Related Questions