We've all seen those messages on some websites warning not to click a button more than once or negative consequences, like paying a bill twice, may result. Sometimes we can cause these problems by hitting the back or refresh buttons. In this article I will explain a methodology whereby a site can ensure each form is submitted only once, thereby demonstrating that such warnings are unnecessary and, depending on the nature of the problems caused, worth repairing immediately. Let's begin by taking a look at the process we are studying: Form Submission. As pedantic as it may seem, it will be worthwhile to detail each of the steps in this process:
Since the item which changes does not depend on the form being submitted (e.g. it doesn't matter if it's a newsletter registration form, customer signup form, payment form, etc.), the item is not something which already exists and therefore must be created, so let's create a form variable called submissionId and assume it has the 3 properties mentioned above. So far, so good -- or so it appears! The third "property" is that "we can tell [it] changed", but "changed" is not a property of a variable, so we need to look at this more closely. In order to tell something changed, we must have a reference point, an answer to the question "changed from what?" This is where a session variable will come into play. If we define a session variable, say $_SESSION['nextValidSubmission'] and treat it as a reference point, we will have all of the tools necessary to protect our visitors. The idea will be to keep the session variable updated with the last submissionId sent out and change the submissionId each time it is sent out to the user. Then, if they try to resubmit the data, they will be submitting an old submissionId which doesn't match nextValidSubmission and we will know not to re-process this data. Let's look at this in terms of the processes:
Webmaster of script reference - The *NEW* PHP Reference & Tutorial Site For Non-Programmers
script reference
One of the things that many people overlook when building... Read More
Your content is what gets you in search engines, speaks... Read More
One of the best tools you have as a webmaster... Read More
Knowledge is power.And undoubtedly, it is the key to making... Read More
Although there are significant differences among the various types of... Read More
The Internet is a remarkable publishing medium. With just a... Read More
Huge Mistake #1: Creating a Website with Flash -- Did... Read More
Building a website and getting it online is easy. Driving... Read More
If one more business owner tells me their website sucks... Read More
Better Web Site ROIHow to increase your business profitability by... Read More
Any new website competing on the internet, needs to take... Read More
You have permission to publish this article electronically, in print,... Read More
Let's begin by setting some limits. If you're like me,... Read More
Now that you have got your domain name registered, your... Read More
I am just a learner who likes to delve in... Read More
A website provides invaluable advantages for businesses who have one.7... Read More
If you're fairly new to the Internet scene, you may... Read More
#5 User Satisfaction: Learn what your visitors and site users... Read More
People often come to me in a state of crisis... Read More
Webmaster tools are vital to becoming both efficient and effective... Read More
Did you know that hosting companies overcrowd their servers despite... Read More
The first thing you will have to deal building your... Read More
A simple website stats counter is not enough if you... Read More
It is an undeniable fact that not everybody is keen... Read More
In the big, wide online world there are millions of... Read More
eco-friendly cleaning service Lincolnshire ...When you take a look at the most visited sites... Read More
So you have decided that you want to do freelance... Read More
After planning the design and content of your website, it's... Read More
Most interactive websites nowadays require data to be presented dynamically... Read More
I'm a freelance programmer and somehow I managed to get... Read More
If you are living in a country that its native... Read More
Here's something you may never have thought of before:If I... Read More
Are you aware that 90% of the websites on the... Read More
The first step in setting up an online business...Starting an... Read More
Internet Marketing is not a miracle marketing strategy ? competition... Read More
Knowledge is power.And undoubtedly, it is the key to making... Read More
SummaryHere's the scoop on what you must know when designing... Read More
Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More
Are you, like many other website owners, frustrated at the... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
In the late 1990's three San Francisco based web developers... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
Failure, just like success, is measured differently by each and... Read More
If you are developing your website on a host that... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
After deciding what kind of internet business you want to... Read More
No matter the size of your business, having a web... Read More
You don't believe in astrology but you check your horoscope... Read More
If you're fairly new to the Internet scene, you may... Read More
If your company own one or more stores, you might... Read More
Web Development |