473,382 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 5436
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hi I have created asp pages to submit logs online. It is used generally to log from handset similar to iPAQ, Pocket PC. I have on html form and one submit button. On pressing submit , it...
2
by: Pamela Chatterjee | last post by:
In my Web Form I have more than one Textbox for user input. If I hit enter to any Textbox its submitting the form. How can I prevent Form submission if users hit enter to the textbox? I want to...
2
by: Nick Bell | last post by:
I have a general form validation question. I know very little about javascript, a little more about PHP. Using yav (http://yav.sourceforge.net): <form method="POST" name=edit onsubmit="return...
2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
6
by: Lloyd Dupont | last post by:
I have a web form with multiple part. I do want the user to click the submit button to post back, so I know which functionality was triggered. unfortunately, when the focus is any text box, if...
14
by: Ed Jay | last post by:
On a multi-textbox form, linked to an external js, I use onBlur to call: function chkNum(cellname) { var str = document.getElementById(cellname).value.toString(10); if (str < 28 || str > 36)...
17
by: emma.sax | last post by:
Hi all, I have a form where we would like the user to input their email address twice, to ensure they've typed it correctly, as is found on most sign-ups I'm looking for a solution to the...
0
by: josephkorn | last post by:
Hi all. I have a problem in my website in trying to prevent a user from double submitting the form. I am calling a subroutine from my page_load event that passes in the commandbutton that I want...
2
by: APA | last post by:
Why does adding code to the form submit function using the RegisterOnSubmitStatement method prevent the server side event handler for the submit button from firing? This is completely useless. I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.