Re: Preventing multiple submits
| From: | Mohammed Abdel'al | Date: | Sat, 09 Sep 2000 13:21:51 +0000 |
| Subject: | Re: Preventing multiple submits | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2544@lists.php.net to get a copy of this message | ||
hey Manuel any manual or readme for that class thing sorry I am totally new
bie but this thing is what I need :)
----- Original Message -----
From: "Zak Greant" <zak@php.net>
To: "Manuel Lemos" <mlemos@acm.org>
Cc: "Pablo Vera" <pvz@vercan.com>; <jd@jamesduncan.co.uk>;
<php-windows@lists.php.net>
Sent: Friday, August 25, 2000 6:40 PM
Subject: Re: [PHP-WIN] Preventing multiple submits
> At 02:45 AM 8/25/00 -0300, Manuel Lemos wrote:
> >[snip]
> >The best solution for really preventing more that one submission of the
> >same form on the server side is to use create a unique key and pass it in
> >the form as hidden field. Store the key in a database (session data area
> >is ideal for this). When the first form submission is received, check if
> >the key exists in the database, delete it, accept the form. On further
> >submissions, check that the key does no longer exist and warn the user
> >that the form was already submitted.
>
> The user's session id will serve very nicely as the unique key. That is
> why I say that only a counter is needed.
>
> > >I know that JavaScript (or any other Client-Side tool) has its
> > >limitations as noted by you before, but with it you will stop the
> > >second submission before it is actually sent. The first script will
> > >run normally and return its output to the browser, without knowing
> > >that the user tried to send the form for a second time. The browser
> > >will no cancel that first connection, because it is not posting a
> > >second form.
> >
> >Right, you may want to check this PHP form generation and validation
class.
> >It has an option to let you specify a text that is used to pop up a
> >confirmation box with Javascript that asks the user if he really means to
> >submit the form again. The user may confirm or cancel the form
submission.
> >
> >This really works great since most of the times you just want to prevent
> >nervous users to submit forms more than once creating inadverted
duplicate
> >database entries.
> >
> >http://phpclasses.UpperDesign.com/browse.html/package/1
>
> The class is more mature and feature-rich than any other form
> generation/validation script that I have run across (or written for that
> matter :) - however, it might be a bit intimidating for a new user!
>
> I suppose that one thing to consider is that javascript is a nice clean
way
> to stop most re-submissions. PHP can be used along with the js to ensure
> robust behavior.
>
> - zak
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>