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
Starting an internet business can be confusing to non-veterans. The... Read More
An interesting eCommerce success factor that isn't precisely overlooked, but... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
In this example I have used the map of the... Read More
Below, I have listed 8 simple steps that you can... Read More
Most interactive websites nowadays would require a user to log... Read More
Some left shoes are in isle 5, while the right... Read More
Designing and creating your own website does not have to... Read More
I had a client say something to me the other... Read More
When marketing your website, it's important to know which of... Read More
It never ceases to amaze me how many people set-up... Read More
1) Word of Mouth The single most powerful form of... Read More
Many small businesses have the misconception that their business can... Read More
Here's something you may never have thought of before:If I... Read More
One of the things that many people overlook when building... Read More
Your business website is a critical aspect of being able... Read More
Have you ever wondered what challenges are faced by other... Read More
The first step in setting up an online business...Starting an... Read More
Server Side Includes (SSI) with ASP People often... Read More
Selecting the Perfect Domain NameThe first issue I have with... Read More
With search engines putting a damper on direct reciprocal links,... Read More
Alternate medicine finds its own place in the hearts and... Read More
There's been widespread speculation about the new legislation being introduced... Read More
I can't think of any business alive today that couldn't... Read More
What is CSS?CSS is a simple file which controls the... Read More
on demand house cleaning Lake Forest ..An accessible Web site is easily approached, easily understood, and... Read More
Designing and creating your own website does not have to... Read More
Every online entrepreneur I talk to is asking the same... Read More
As a business you can't afford to ignore the Internet... Read More
1. Address your targeted audience on your business site. Example:... Read More
For years now I've been looking to start my own... Read More
Does My Web Site Require A Web Database?If your web... Read More
There's been widespread speculation about the new legislation being introduced... Read More
Are you, like many other website owners, frustrated at the... Read More
If one more business owner tells me their website sucks... Read More
There are several reverse bid freelance sites out there. Beyond... Read More
Just starting out, you can start with a simple informational... Read More
One of the things that Internet excels is disseminating information... Read More
"Build it and they will come."--Filed of Dreams (1989) If... Read More
So you've decided to start an online work at home... Read More
Rosalind wants to share her inspirational poetry with a wider... Read More
Part of the success of most home-based businesses is their... Read More
Some left shoes are in isle 5, while the right... Read More
Dynamically Update Your Web Pages Via E-MailIf you can Send... Read More
You hear a great deal about the Internet these days... Read More
If you have your own business website and you are... Read More
Before you jump into spending coutnless hours on designing and... Read More
Often time I've browsed sites and seen the same thing... Read More
So your traffic is going through the roof yeah? It's... Read More
Starting and maintaining a business is challenging enough without the... Read More
Web Development |