471,319 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Dupe Prevent on Form Submit

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
3 5345
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
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
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.

Similar topics

2 posts views Thread by Pamela Chatterjee | last post: by
6 posts views Thread by Lloyd Dupont | last post: by
14 posts views Thread by Ed Jay | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.