How about mixing the 2???



-----Original Message-----
From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
Sent: 04 March 2002 16:51
To: 'Richard Black'; 'Jennifer Downey'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Tutorial?

Javascript will functionally solve the problem, but since Javascript is an
optional piece of the browser that can be turned off/on, and functions
differently in different browsers, it's definitely far from fool-proof. You
could get it working 99.9% in IE and Navigator, but then have it fail in
another browser, which is why I suggested my PHP, server-side method, which
cannot be turned off based on a client's browser.

- Jonathan

-----Original Message-----
From: Richard Black [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 8:47 AM
To: Jonathan Hilgeman; 'Jennifer Downey'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Tutorial?

I've also seen something similar implemented using javascript (i guess -
never looked into it in any detail)

The online bank I use does this. Basically, when I click a submit button,
the button is replaced by an image (like a greyed out submit button) which
has the caption Submitted. Clicking this does nothing.

Like I say, I'm 99.9% positive this is implemented using javascript, but
have never investigated how it works...


Richard Black
Systems Programmer, DataVisibility Ltd -
Tel: 0141 435 3504

-----Original Message-----
From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
Sent: 04 March 2002 16:40
To: 'Jennifer Downey'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Tutorial?

Hi Jennifer,
I'm guessing the purpose of this would be to keep people from
double-clicking and submitted information twice, possibly making an
application deduct payment twice or something important similar in nature.

The best way I've found of accomplishing the goal of keeping people from
clicking twice has three parts:
1) Quickly switching the page. On the next page, have PHP write out about
300 spaces and a newline, then call the flush() function to make the output
get sent to the browser. In many cases, this will cause the browser to
quickly switch to the next page and display a blank page while the data gets

2) It's still remotely possibly to click twice even if you have part 1 in
place, so this is a more fool-proof method. Store your data in a database
before processing it - along with a timestamp. When the person clicks the
submit button twice, the program checks the database to see if there is the
same information with a very close timestamp. If so, update the timestamp in
the database. At this point you can choose 3 paths:

- Store the data so you can batch-process the data at a later time, once you
are sure that the visitor has left and there will be no more clicks. For
example, have a program that runs every 5 minutes (via cron), then have that
program check for data/orders that are at least 5 minutes old, and process
them. That means that the timestamp hasn't been updated by extra clicks in 5
minutes (and you could still have notified the visitor that their order or
data request is now in line to be processed).

- Process the data immediately. If you need to process an order immediately
and give back results, use the above method, but modify it a bit. Instead of
just displaying notification that their order is in line to be processed,
you can submit to another PHP program which sleeps for about 3-4 seconds,
then checks the database until there are no clicks for at least 4 seconds,
and THEN processes the data, and returns a value to the screen in like 4-5
seconds. Both of these methods have similar goals, though - Receive data and
timestamp it, Wait $Time, Check for timestamp updates, Process when
timestamp is $Time old.

3) Have a very visible notice that people should not click multiple times,
or else undesirable results may occur, and we want "your" request/order to
be perfect. Emphasize the request to click only once and to be patient, and
if something goes wrong, here's how to contact us.

- Jonathan

-----Original Message-----
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2002 10:18 PM
Subject: [PHP-DB] Tutorial?

Hi all,

Can anyone point me to a good tutorial on how to disable a submit button
once clicked?
preferably in php.

Jennifer Downey

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to