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
See here for more detailed information, an example using PHP, and an alternate method which doesn't require sessions.
Cost Effective Advertising. Online selling. Increased geopgraphic range. Wider... Read More
1. Address your targeted audience on your business site. Example:... Read More
What is web accessibility & why is it important?Web accessibility... Read More
Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More
Failure, just like success, is measured differently by each and... Read More
How popular is online shopping? And is there room for... Read More
There are several reverse bid freelance sites out there. Beyond... Read More
With all of the factors involved in designing and building... Read More
The internet is a sea of knowledge. Getting your information... Read More
The big thing these days is your ability to capture... Read More
Starting and maintaining a business is challenging enough without the... Read More
Many executives and investors are skeptical that software products can... Read More
An Introduction to Server Side IncludesBeginner? That's OK!While much has... Read More
Your site is fast and getting traffic, but conversion rates... Read More
How many Web Sites did you stumble over telling you... Read More
Why do some sites succeed while the vast majority of... Read More
Running an effective website is a continuous process. I have... Read More
Creating a content management system either from scratch,... Read More
Every small business owner knows that they need a website,... Read More
After years of working with entrepreneurs who developed their first... Read More
If you have some experience in web site design and... Read More
Are you, like many other website owners, frustrated at the... Read More
QUESTION: Should I build and maintain my business Web... Read More
Building a new website can be a lengthy task. From... Read More
It is an undeniable fact that not everybody is keen... Read More
More and more businesses are recognizing the importance of content... Read More
Web accessibility has so many benefits that I really do... Read More
Do you make your website just to entertain yourself or... Read More
What is the point of having a website, you may... Read More
Understanding and using web analytics.In recent years, website marketers were... Read More
Your content is what gets you in search engines, speaks... Read More
I talk with so many people who have small businesses... Read More
Before you set up any scripts you will need some... Read More
I recently helped my mom to launch a website (www.mom2me.com)... Read More
Looks like every client wants a Flash site these days... Read More
I am just a learner who likes to delve in... Read More
Dynamically Update Your Web Pages Via E-MailIf you can Send... Read More
When most people build a web site, they think one... Read More
In this example I have used the map of the... Read More
Here's something you may never have thought of before:If I... Read More
Like wine cars get more attractive to collectors as years... Read More
D.zigns dzignerwebs The Basics Before starting on... Read More
Build it and they will come is not always true;... Read More
Everyday thousands of new businesses make the leap and take... Read More
There are many elements that are key to successful web... Read More
More and more non-profit organizations are developing websites to help... Read More
Dan Kennedy once said that if you can't make money... Read More
Launching a new small business website is often a long... Read More
There are many different traffic analysis tools, ranging from simple... Read More
Web sites are not just places to sell things; they... Read More
If you don't have a web site yet, are thinking... Read More
Three way linking and concerns.For many years SEO experts were... Read More
Just starting out, you can start with a simple informational... Read More
The following is a list of patterns that many visitors... Read More
A company must earn and keep trust or sales don't... Read More
If you are like me you have wanted to build... Read More
This is a growing concern amongst many business owners. Does... Read More
In the region where my company is located, South Bend,... Read More
So you have a good idea for a business and... Read More
Conceptualize, Build and Publish a Web site - What's required... Read More
The "robots" meta tag, when used properly, will tell the... Read More
Revenues are often lost because many business owners don't see... Read More
Affiliate programs are a great way to earn an income... Read More
Designing and creating your own website does not have to... Read More
Losing website sales and traffic is sometimes simply a case... Read More
Have you ever wondered what challenges are faced by other... Read More
Web Development |