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.
It's now easier than ever to take payments on the... Read More
See how you can create graphic effects on text with... Read More
You've put up a website to promote a product or... Read More
If you haven't made the sales and built your clients... Read More
I've heard several prominent web marketers mention in their classes... Read More
Any new website competing on the internet, needs to take... Read More
What is SQL? SQL stands for Structured Query Language and... Read More
When marketing your website, it's important to know which of... Read More
Server Side Includes (SSI) with ASP People often... Read More
Have you ever wondered what challenges are faced by other... Read More
Many small businesses have the misconception that their business can... Read More
A PHP Redirect automatically transfers a web user from one... Read More
Web sites are not just places to sell things; they... Read More
There are many elements that are key to successful web... Read More
You don't believe in astrology but you check your horoscope... Read More
Most web sites are more like stage sets than real... Read More
In the time that I have been using the Internet,... Read More
Some left shoes are in isle 5, while the right... Read More
Absolutely everything stems from the purpose of your website -... Read More
When you take a look at the most visited sites... Read More
There was a time not long ago when setting up... Read More
"I don't sell anything online, I don't advertise online, in... Read More
You have permission to publish this article electronically, in print,... Read More
"If you build it, they will come"; is an age... Read More
After planning the design and content of your website, it's... Read More
The Internet has opened a whole New World of opportunity... Read More
"I have a small business with just a couple of... Read More
If you're fairly new to the Internet scene, you may... Read More
The growth in Internet usage around the world is astounding... Read More
1. The first page appears quickly.It's a good way to... Read More
I am just a learner who likes to delve in... Read More
Right after the thought, "I need a website," people usually... Read More
In this example I have used the map of the... Read More
Part of the success of most home-based businesses is their... Read More
"I am a writer, not a business-person. I don't want... Read More
Internet has opened a whole new world for web developers... Read More
Optimal website design is the art of logical navigation.It will... Read More
Designing an E-commerce Web site is not as simple as... Read More
I've heard several prominent web marketers mention in their classes... Read More
While studying online for IT investment opportunities, I found that... Read More
If one more business owner tells me their website sucks... Read More
If you ever want to create a state directory, article... Read More
Before you jump into spending coutnless hours on designing and... Read More
Every small business owner knows that they need a website,... Read More
What you should do and know if you are an... Read More
Directory Generator, a product from Armand Morin and Marc Quarles,... Read More
What is web accessibility & why is it important?Web accessibility... Read More
After deciding what kind of internet business you want to... Read More
If you were asked to put a value on your... Read More
An automated accessibility tool is a piece of software which... Read More
Thinking about starting up a business? The web is the... Read More
If you're looking for better web site ROI, chances are,... Read More
So you want to have a website. You have gone... Read More
Starting an internet business can be confusing to non-veterans. The... Read More
Does your website have a links/resources page?Do you exchange reciprocal... Read More
What is SQL? SQL stands for Structured Query Language and... Read More
Your site is fast and getting traffic, but conversion rates... Read More
There have been many significant changes to the face of... Read More
How do you decide on the content, products and or... Read More
Many websites I come across don't have a single link... Read More
Even though the Internet has been around for a long... Read More
The following is a list of patterns that many visitors... Read More
1) Data CaptureOne easy way to collect e-mail addresses and... Read More
Often time I've browsed sites and seen the same thing... Read More
The growth in Internet usage around the world is astounding... Read More
Customer service questionnaires can help your clients better understand their... Read More
Web Development |