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.
![]() |
|
![]() |
|
![]() |
|
![]() |
If you're fairly new to the Internet scene, you may... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
The "robots" meta tag, when used properly, will tell the... Read More
Thinking about starting up a business? The web is the... Read More
The process of Web application development is critical to the... Read More
The definition of the phrase "Content Management" depends on what... Read More
1. Be clear on your purpose.Building a website can be... Read More
Most interactive websites nowadays would require a user to log... Read More
A system development process can follow a number of standard... Read More
Selecting the Perfect Domain NameThe first issue I have with... Read More
If you've been developing websites on Mars for the past... Read More
Recently, a friend asked "What's the deal with those DIY... Read More
Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More
Alternate medicine finds its own place in the hearts and... Read More
What happened on your website yesterday? What about last week... Read More
Website, website, website, everyone says you need one. But do... 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
People like to get immediate responses to requests. Autoresponders are... Read More
The internet has taken over our lives with a vengeance,... Read More
Developing a website with content that entices visitors to return... Read More
I talk with so many people who have small businesses... Read More
Fantastico is a 3rd-party cPanel add-on and can be purchased... Read More
What do you mean, you don't have a website for... Read More
Three way linking and concerns.For many years SEO experts were... Read More
After deciding what kind of internet business you want to... Read More
Starting and maintaining a business is challenging enough without the... Read More
If you don't have a web site yet, are thinking... Read More
Making money with your web site is the dream and... Read More
The Internet is a remarkable publishing medium. With just a... Read More
When I started my company in 2002, I knew I... Read More
The first step in setting up an online business...Starting an... Read More
Never has competition been so difficult in the Internet world.... Read More
I'm one of those people that always wanted a website,... Read More
cPanel is a control panel for your website and allows... Read More
I still remember it very clear ... It was almost... Read More
The art of turning website visitors into paying customers depends... Read More
Alternate medicine finds its own place in the hearts and... Read More
Many executives and investors are skeptical that software products can... Read More
A simple website stats counter is not enough if you... Read More
Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More
Does My Web Site Require A Web Database?If your web... Read More
Is your website Really useful?I had a 'rep' in yesterday... Read More
Even though the Internet has been around for a long... Read More
While creating a Web site may seem like... Read More
The cost of setting up a web site is dirt... Read More
"How do I improve web site sales figures?" The CEO... Read More
Making money with your web site is the dream and... Read More
Recently, a friend asked "What's the deal with those DIY... Read More
If you're looking for better web site ROI, chances are,... Read More
Most web sites are more like stage sets than real... Read More
Although CSS layouts have been around for years, they haven't... Read More
RIVERSIDE, CA August 4, 2004 ?- "Historically, small business owners... Read More
If one more business owner tells me their website sucks... Read More
Dynamically Update Your Web Pages Via E-MailIf you can Send... Read More
A website lets you put your products in front of... Read More
"What's in it for me?" you ask. "Why should I... Read More
Some left shoes are in isle 5, while the right... Read More
So you've decided to start an online work at home... Read More
How popular is online shopping? And is there room for... Read More
Starting a business online is no longer as difficult as... Read More
We all start out the same. Some have budgets, some... Read More
First, an eye opener. Making your fortune through affiliate programs... Read More
A system development process can follow a number of standard... Read More
Designing and creating your own website does not have to... Read More
Q. Hey, Cathy: I'm just setting up a website. What... Read More
Web Development |