Re: Double click problem
| From: | Dan Joseph | Date: | Wed, 19 Mar 2008 15:51:24 +0000 |
| Subject: | Re: Double click problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271800@lists.php.net to get a copy of this message | ||
On Wed, Mar 19, 2008 at 11:48 AM, tedd <tedd@sperling.com> wrote:
> In the last step in the process, the user clicks a "confirm purchase"
> button and their credit card is checked and if it's valid, they are
> awarded the product. Everything works, but it takes a little time to
> check the credit card.
>
> During the time it takes to send the credit card information to the
> clearing house and get back an "Ok" with a transaction ID, the user
> can click the "confirm purchase" button more than once. As such, more
> than one order can be made during the process.
>
> I was thinking of using the database to prohibit multiple "confirm
> purchase" clicks made by the user, but I wanted to ask this group if
> anyone has a simpler idea/solution?
>
>
>
>
I had a similar problem with one of our applications here. I ended up
adding some javascript to disable the button once clicked, and then putting
in code in the php to prevent duplicates. It seemed to do the trick. I can
send over some sample code if you need. For the javascript I just made the
submit button hit a function, disable the button, then submit the form.
--
-Dan Joseph
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."