tedd wrote:
I have a situation where users can purchase stuff online.
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?
In the onclick for the button...
onclick="this.disabled=1;this.value='Processing, please wait...';"
You can also do this in the onsubmit of the form but you obviously need
to change this to a document.getElementById.
I'd also recommend you put some JS at the end of the page to enable the
button and set its value otherwise users hitting the back button may be
presented with a disabled button which is annoying.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php