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
If you are developing your website on a host that... Read More
You have seen those web pages where they have the... Read More
Even though the Internet has been around for a long... Read More
Every online entrepreneur I talk to is asking the same... Read More
In 1995 a new era of accessibility for disabled people... Read More
This article was prompted by some customer support work I... Read More
Many of site owners still don't realize all advantages of... Read More
Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More
There are millions and millions of websites on the Internet.... Read More
Setting up a website is the very first step of... Read More
Part of the success of most home-based businesses is their... Read More
A while ago one of my clients approached me and... Read More
What do you mean, you don't have a website for... Read More
Globalize Your WebsiteThe Internet has unlocked a wide array of... Read More
One of the best tools you have as a webmaster... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
Many small companies choose not to invest in a professionally... Read More
Thinking about starting up a business? The web is the... Read More
It never ceases to amaze me how many people set-up... Read More
QUESTION: Should I build and maintain my business Web... Read More
A website lets you put your products in front of... Read More
In my previous life.....Actually, my previous JOB life, I was... Read More
Any new website competing on the internet, needs to take... Read More
You want to give your site's visitors a way to... Read More
I recently helped my mom to launch a website (www.mom2me.com)... Read More
Wood Dale limo .."I am a writer, not a business-person. I don't want... Read More
You know exactly what your organisation does and what your... Read More
Server Side Includes (SSI) with ASP People often... Read More
I've heard several prominent web marketers mention in their classes... Read More
In this example I have used the map of the... Read More
When I set up my website I felt paypal was... Read More
After having decided to start a business, the next thing... Read More
What is CSS?CSS is a simple file which controls the... Read More
Go to any internet marketing forum you want these days... Read More
Like any area of business your website needs some effort... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
One of the biggest mistakes that most online retailers make... Read More
How can we add Word Rich Content to our Websites... Read More
Fantastico is a 3rd-party cPanel add-on and can be purchased... Read More
An accessible Web site is easily approached, easily understood, and... Read More
Build it and they will come is not always true;... Read More
Profiles are one of the best kept secrets around regarding... Read More
Do you make your website just to entertain yourself or... Read More
If you're anything like most small business owners, you probably... Read More
Failure, just like success, is measured differently by each and... Read More
Just like all things in life, the ways to run... Read More
With the New Year upon us yet again, it's time... Read More
Does your website have a links/resources page?Do you exchange reciprocal... Read More
Webmasters deal with a myriad of complex design challenges every... Read More
Everyday thousands of new businesses make the leap and take... Read More
Web Development |