RE: [PHP-WIN] Preventing multiple submits
| From: | Manuel Lemos | Date: | Wed, 30 Aug 2000 02:08:21 +0000 |
| Subject: | RE: [PHP-WIN] Preventing multiple submits | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2281@lists.php.net to get a copy of this message | ||
Hello James,
On 25-Aug-00 13:05:49, you wrote:
>I agree. As a new user I couldn't follow or understand the class :( Maybe I
You don't have to follow the class because it does much more than you need.
Just read the relevant parts of the manual and supplied examples. You may
even not use the actual class code in your site. Since you just want to
prevent multiple submission, just write a small script that uses the class
to do that, run the script and snip the actual Javascript code that it
generates.
>will just accept the Javascript client side solution as it's only takes a
>few lines to disable the submit button once it's been pressed, whereas the
>PHP code to achieve the same kind of result seems to be rather complex
>(sessions, etc). I really wanted to keep everything server side though
>because then I could be 100% sure the user couldn't submit the form more
>than once.
You can't really stop multiple form submissions on the server side, you can
only detect when they happen and do something about it. Besides that, you
can try to use Javascript code to disable submit buttons but AFAIK, that only
works in IE 4 or better.
What the class does with the generated code is to detect if the submit can
be disabled and if possible do it. If not possible, there is always a
chance that the form gets submitted more than once, even though the class
uses a local Javascript variable to make a confirmation box show when the
form is submitted again.
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--