Re: Preventing double-clicks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay,

I use a technique to prevent hitting the "back" button and
resubmitting data. I use a 2-script process, one with the form and
"submit" button (I set a session var here), and a second form (the
"action" script). The action script makes sure the session variable is
set, processes the info, then clears the session var. If the session
var is not set, an error is displayed.

Gerry

On 6/26/06, Jay Blanchard <jblanchard@xxxxxxxxxx> wrote:
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.

The steps are;

1. Fill out form
2. Click 'Submit'
3. Data gets stored (including unique data and time stamp data in this
case....which should work out well)
If the process sees the unique data and a timestamp sometime within the
last minute it should ignore the subsequent attempt.
4. A reply is returned to the user based on the first click. The data
returned to the user would be different for each click, that is why this
is so important. The first data returned is the correct data.

My confusion is in this (as I have mentioned in the past couple of
weeks, most of the confusion is as a result of a lack of rest, which
leads to not thinking clearly, which leads to me feeling ignorant); upon
the second click, where I check to see if the data has been entered and
find that it has how do I get it to return the data back to the user. I
think I see it now......let's see.....if I;

Select * from foo where data is what it is and time is within last
interval that I decide upon;

if(1 == mysql_num_rows(that query up there)){
   get that data for return to the user;
} else {
   Insert data, do calcs, return data back to user;
}

Does that look reasonable, or am I missing something?

Thanks for any insight!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux