Hi Friends !
I need to discuss a problem with you.
When we fill a customer info form, and redirect to other page. but go back by browser's back button and resubmit the form.
In this case duplicate data is inserted. Or when we refresh a page multiple data is inserted, so HOW TO AVOID this terrible problem ?
Duplicate Insertion Problem !
Moderator: General Moderators
Re: Duplicate Insertion Problem !
Hi whmemon
There are a few ways to get around this problem. One I've successfully used before was to create two extra fields in the database table you are updating: ip and timestamp.
On processing form submissions, store the user's IP, using $_SERVER['REMOTE_ADDR'], and the current timestamp, using the time() function, with the information you are capturing.
Then update your code to run a check to pull rows from that database table where the current IP has made a submission in, say, the last 60 seconds. If your check returns a row, you're most likely dealing with a duplicate submission, so don't process the request.
There are a few ways to get around this problem. One I've successfully used before was to create two extra fields in the database table you are updating: ip and timestamp.
On processing form submissions, store the user's IP, using $_SERVER['REMOTE_ADDR'], and the current timestamp, using the time() function, with the information you are capturing.
Then update your code to run a check to pull rows from that database table where the current IP has made a submission in, say, the last 60 seconds. If your check returns a row, you're most likely dealing with a duplicate submission, so don't process the request.