By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,639 Members | 3,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,639 IT Pros & Developers. It's quick & easy.

Dupe Prevent on Form Submit

P: n/a
I have an html form, that has fields and when the submit button is pressed,
the information is transferred to a php file. Which then inserts the data
into my sql database. How can I go about ensuring that someone isn't able to
submit thier information twice, or to somehow have the database checked
before inserting the information, to see if it's there already. I have some
duplicates happening and would like to stop it.
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can generate a random number and insert it into your html file as hidden
form variable. So when someone submits the form you can check for that
value. If someone just go back and hit submit again or did the page refresh
after submitting you will get the same number.

A more robust method would require checking against the database.

sanjay
"entoone" <en*****@pacbell.net> wrote in message
news:2G***************@newssvr14.news.prodigy.com. ..
| I have an html form, that has fields and when the submit button is
pressed,
| the information is transferred to a php file. Which then inserts the data
| into my sql database. How can I go about ensuring that someone isn't able
to
| submit thier information twice, or to somehow have the database checked
| before inserting the information, to see if it's there already. I have
some
| duplicates happening and would like to stop it.
|
|
Jul 17 '05 #2

P: n/a
Hello,

On 10/29/2003 02:12 PM, entoone wrote:
I have an html form, that has fields and when the submit button is pressed,
the information is transferred to a php file. Which then inserts the data
into my sql database. How can I go about ensuring that someone isn't able to
submit thier information twice, or to somehow have the database checked
before inserting the information, to see if it's there already. I have some
duplicates happening and would like to stop it.


There are ways and ways to prevent duplicate submission. Some require
sophisticated session variable schemes to detect when a form is being
submitted more than once.

If you want just to prevent that nervous users to click on the submit
button more than once, you may want to try this class that among other
things it can let you specify a message that will appear in alert that
will ask the user if he really meants to submit the form again. This has
been helping to prevent a lot of duplicate submissions.

http://www.phpclasses.org/formsgeneration

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #3

P: n/a
entoone <en*****@pacbell.net> wrote:
I have an html form, that has fields and when the submit button is pressed,
the information is transferred to a php file. Which then inserts the data
into my sql database. How can I go about ensuring that someone isn't able to
submit thier information twice, or to somehow have the database checked
before inserting the information, to see if it's there already. I have some
duplicates happening and would like to stop it.


Sounds like you mean protection against a boucing
mouse click in which case a great solution already
suggested. Make it visual!

The best solution also covers someone that comes
back a day later. Do a select based on some column
you have like user name or email address? There
is always the opportunity for mis-spelling though.
If they are already in the DB put up a message.
As said there are lots of varying degree solutions.
And none really unique to PHP :) from what I see.
-Walt

--
Reply to innkeepATcapitalDOTnet to email questions.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.