By MD Fozla Rabbi , SEO Specialist
A customer taps "Order" on your child panel. The mobile data in their area hiccups. Nothing seems to happen. So they tap again. And again.
Three requests hit your server. Three orders go to the upstream panel. Three charges come out of their wallet. Then comes the angry message, usually with screenshots and a lot of exclamation marks.
This isn't a rare edge case. On patchy mobile connections it happens all the time.
The fix has a fancy name, idempotency, and a simple idea behind it: the same request should only ever create one order, no matter how many times it arrives. Let's build that in plain PHP and MySQL.
Why disabling the button isn't enough
The first instinct is to disable the button after one click. Do it. It helps. But it doesn't solve the problem:
Network retries. Some browsers and proxies retry a request that seemed to time out.
Back button and refresh. The form gets resubmitted.
Two tabs.…