Prevention for multiple submissions from the same form
Prevention for multiple submissions from the same form
am 04.10.2007 13:09:01 von T K
Hi,
I have a form with a button, which adds user inputted data into
database. I've been looking for a way to prevent users from pressing
the same button twice mistakingly.
I've learned that this is possible to make and send a unique id in
hidden input, and check if the id is used before database query is
issued. (PHP Cookbook [O'reilly]).
But, is there a way to make this happen without using database? It
would cool if I could only use HTML/JavaScript/CSS.
Tek.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Prevention for multiple submissions from the same form
am 04.10.2007 14:57:57 von Trevor Gryffyn
The most common method I've seen is with Javascript. onsubmit, disable
submit button.
As a backup, in case the user's JS is disabled, you might consider the unique
ID thing.
-TG
----- Original Message -----
From: "T K"
To: php-db@lists.php.net
Date: Thu, 4 Oct 2007 20:09:01 +0900
Subject: [PHP-DB] Prevention for multiple submissions from the same form
> Hi,
>
> I have a form with a button, which adds user inputted data into
> database. I've been looking for a way to prevent users from pressing
> the same button twice mistakingly.
>
> I've learned that this is possible to make and send a unique id in
> hidden input, and check if the id is used before database query is
> issued. (PHP Cookbook [O'reilly]).
>
> But, is there a way to make this happen without using database? It
> would cool if I could only use HTML/JavaScript/CSS.
>
> Tek.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Prevention for multiple submissions from the same form
after submit direct the user to a different page...or use js and disable th=
e button after the first click
=20
bastien> Date: Thu, 4 Oct 2007 20:09:01 +0900> From: tek.katu@gmail.com> To=
: php-db@lists.php.net> Subject: [PHP-DB] Prevention for multiple submissio=
ns from the same form> > Hi,> > I have a form with a button, which adds use=
r inputted data into> database. I've been looking for a way to prevent user=
s from pressing> the same button twice mistakingly.> > I've learned that th=
is is possible to make and send a unique id in> hidden input, and check if =
the id is used before database query is> issued. (PHP Cookbook [O'reilly]).=
> > But, is there a way to make this happen without using database? It> wou=
ld cool if I could only use HTML/JavaScript/CSS.> > Tek.> > -- > PHP Databa=
se Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.ph=
p.net/unsub.php>=20
____________________________________________________________ _____
Express yourself with new emoticons. It=92s easy! Try it!
http://www.freemessengeremoticons.ca/=
--_2f34f084-2214-4151-be45-c1cfba4a59df_--
RE: Prevention for multiple submissions from the same form
am 04.10.2007 16:10:51 von Jonathan Gravois
I used the JavaScript method to disable the button after the first click and
discovered from irate customers and administration that this resulted in an
unsubmittable form on the AOL Browser although it worked perfectly in all
others. Just a mention in case your clientele is AOL heavy (like ours).
Jon
-----Original Message-----
From: Bastien Koert [mailto:bastien_k@hotmail.com]
Sent: Thursday, October 04, 2007 9:06 AM
To: T K; php-db@lists.php.net
Subject: RE: [PHP-DB] Prevention for multiple submissions from the same form
after submit direct the user to a different page...or use js and disable the
button after the first click
bastien> Date: Thu, 4 Oct 2007 20:09:01 +0900> From: tek.katu@gmail.com>
bastien> To: php-db@lists.php.net> Subject: [PHP-DB] Prevention for
bastien> multiple submissions from the same form> > Hi,> > I have a form
bastien> with a button, which adds user inputted data into> database.
bastien> I've been looking for a way to prevent users from pressing> the
bastien> same button twice mistakingly.> > I've learned that this is
bastien> possible to make and send a unique id in> hidden input, and
bastien> check if the id is used before database query is> issued. (PHP
bastien> Cookbook [O'reilly]).> > But, is there a way to make this
bastien> happen without using database? It> would cool if I could only
bastien> use HTML/JavaScript/CSS.> > Tek.> > -- > PHP Database Mailing
bastien> List (http://www.php.net/)> To unsubscribe, visit:
bastien> http://www.php.net/unsub.php>
____________________________________________________________ _____
Express yourself with new emoticons. It's easy! Try it!
http://www.freemessengeremoticons.ca/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Prevention for multiple submissions from the same form
am 04.10.2007 16:18:41 von Lasitha Alawatta
Hi TK,
Try this,
bmit" value=3D"Submit" <=3Fphp
if($_POST['butSubmit']=='Submit') {=
=3F> disabled=3D"disabled" <=3Fphp }=3F> >
Regards,=0D=
=0ALasitha
=0A-----Original Message-----
From: =
T K [mailto:tek.katu@gmail.com]
=0ASent: Thursday, October 04, 2007 3:=
09 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Prevention for m=
ultiple submissions from the same form
Hi,
I have a f=
orm with a button, which adds user inputted data into
database. I've b=
een looking for a way to prevent users from pressing
the same button t=
wice mistakingly.
I've learned that this is possible to make and=
send a unique id in
hidden input, and check if the id is used before =
database query is
issued. (PHP Cookbook [O'reilly]).
But, i=
s there a way to make this happen without using database=3F It
would c=
ool if I could only use HTML/JavaScript/CSS.
Tek.
-- =0D=
=0APHP Database Mailing List (http://www.php.net/)
To unsubscribe, vis=
it: http://www.php.net/unsub.php
DOTW DISCLAIMER:
=0D=
=0AThis e-mail and any attachments are strictly confidential and intended f=
or the addressee only. If you are not the named addressee you must not disc=
lose, copy or take
any action in reliance of this transmission and you=
should notify us as soon as possible. If you have received it in error, pl=
ease contact the message sender immediately.
This e-mail and any attac=
hments are believed to be free from viruses but it is your responsibility t=
o carry out all necessary virus checks and DOTW accepts no liability
i=
n connection therewith.
=0AThis e-mail and all other electronic =
(including voice) communications from the sender's company are for informat=
ional purposes only. No such communication is intended
by the sender =
to constitute either an electronic record or an electronic signature or to =
constitute any agreement by the sender to conduct a transaction by electron=
ic means.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Prevention for multiple submissions from the same form
am 04.10.2007 17:14:44 von T K
Thank you for answering my question. Can anybody explain a simple
JavaScript only solution? I haven't used JavaScript except for some
copy-and-paste jobs.
Tek
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Prevention for multiple submissions from the same form
try
=20
le.disabled=3Dtrue;' />
=20
bastien
> Date: Fri, 5 Oct 2007 00:14:44 +0900> From: tek.katu@gmail.com> To: php-d=
b@lists.php.net> Subject: Re: [PHP-DB] Prevention for multiple submissions =
from the same form> > Thank you for answering my question. Can anybody expl=
ain a simple> JavaScript only solution? I haven't used JavaScript except fo=
r some> copy-and-paste jobs.> > Tek> > -- > PHP Database Mailing List (http=
://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>=20
____________________________________________________________ _____
Get cool Messenger Emoticons! Click here to learn more.
http://www.freemessengeremoticons.ca/=
--_afb0ae8d-aaf7-45fd-aafd-2a15d98d19f2_--
Re: Prevention for multiple submissions from the same form
am 05.10.2007 10:34:50 von Oskar
T K napsal(a):
> I've learned that this is possible to make and send a unique id in
> hidden input, and check if the id is used before database query is
> issued. (PHP Cookbook [O'reilly]).
Why? You should always ensure that only unique data are inserted into
database. This is not just about multiple submissions. Visitor can
submit form then forgets about that so he goes back and submits the same
thing again.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Prevention for multiple submissions from the same form
am 05.10.2007 14:52:53 von Trevor Gryffyn
But what if the data being inserted isn't unique? What if it's a voting
form that says "Do you like pie? Yes/No"? True, it could record the
response and the userid or IP address so that would be a unique pairing but
what if the vote was anonymous and you allowed multiple people from the
same IP address (ie behind a firewall/proxy) to submit votes?
There could be cases where the data isn't necessarily unique, is all I'm
saying. In which case you could use the unique ID thing to make sure it's
not a double-submit from the same person, or only allow a submission every
XX seconds from a single IP address, or maybe create some kind of
fingerprint of the voter using their browser type and version or some other
odd method. The unique ID thing is by far the simplest and less
discriminatory against people beind firewalls or proxies.
So you see, there is some kind of case for allowing non-unique input into the
database, depending on the circumstances.
-TG
----- Original Message -----
From: OKi98
To: T K
Cc: php-db@lists.php.net
Date: Fri, 05 Oct 2007 10:34:50 +0200
Subject: Re: [PHP-DB] Prevention for multiple submissions from the same form
> T K napsal(a):
> > I've learned that this is possible to make and send a unique id in
> > hidden input, and check if the id is used before database query is
> > issued. (PHP Cookbook [O'reilly]).
> Why? You should always ensure that only unique data are inserted into
> database. This is not just about multiple submissions. Visitor can
> submit form then forgets about that so he goes back and submits the same
> thing again.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Prevention for multiple submissions from the same form
am 08.10.2007 11:12:35 von Oskar
TG napsal(a):
> But what if the data being inserted isn't unique? What if it's a voting
> form that says "Do you like pie? Yes/No"? True, it could record the
> response and the userid or IP address so that would be a unique pairing but
> what if the vote was anonymous and you allowed multiple people from the
> same IP address (ie behind a firewall/proxy) to submit votes?
>
simple solution with timestamp - you allow to vote from 1 ip once in a
given time (day, hour, minute, second, depends on you)
> There could be cases where the data isn't necessarily unique
Sorry, I dont know any.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php