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
Just starting out, you can start with a simple informational... Read More
Here's something you may never have thought of before:If I... Read More
If your company own one or more stores, you might... Read More
With more and more countries around the world passing laws... Read More
A website provides invaluable advantages for businesses who have one.7... Read More
What do you mean, you don't have a website for... Read More
If you ever want to create a state directory, article... Read More
A company must earn and keep trust or sales don't... Read More
You've decided to create a website to market your products... Read More
My life's greatest passion is a safari hobby. And what... Read More
Does your website have a links/resources page?Do you exchange reciprocal... Read More
Did you know that hosting companies overcrowd their servers despite... Read More
Website, website, website, everyone says you need one. But do... Read More
The popular search engine Google indexes over 8 billion websites.... Read More
This is a growing concern amongst many business owners. Does... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
Most web sites are more like stage sets than real... Read More
You've put up a website to promote a product or... Read More
No matter what browser you may want to use, you... Read More
For years now I've been looking to start my own... Read More
The "robots" meta tag, when used properly, will tell the... Read More
The first thing my business consultant (read brother-in-law) asked me,... Read More
Directory Generator, a product from Armand Morin and Marc Quarles,... Read More
So you have a good idea for a business and... Read More
When you take a look at the most visited sites... Read More
taxi o'hare Auburn ..This article was prompted by some customer support work I... Read More
If you're an up and coming graphic/web designer just out... Read More
1. Upload robots.txt file in to your root directory and... Read More
Revenues are often lost because many business owners don't see... Read More
If you ever want to create a state directory, article... Read More
"Build it and they will come."--Filed of Dreams (1989) If... Read More
When we review the sites of potential clients, there are... Read More
So what do you do if need to get a... Read More
Your website conversion rate should concern you. This simply refers... Read More
You've just finished congratulating your marketing team. After six months... Read More
No matter what browser you may want to use, you... Read More
Thousands of people are now making a living online and... Read More
Now that you have got your domain name registered, your... Read More
In this day and age most businesses consider having their... Read More
Before you start building your site, ask yourself "WHY?". Why... Read More
While creating a Web site may seem like... Read More
Did you know that hosting companies overcrowd their servers despite... Read More
A PHP Redirect automatically transfers a web user from one... Read More
A professional online reputation is essential to the flourishing of... Read More
One of the most useful features offered by some web... Read More
There is an ongoing debate about web copy. Some say... Read More
Have you ever thought the secret behind the success of... Read More
Failure, just like success, is measured differently by each and... Read More
QUESTION: Should I build and maintain my business Web... Read More
Is your website Really useful?I had a 'rep' in yesterday... Read More
Web Development |