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
We are clearly well past the innocent "golden age" of... Read More
You want to give your site's visitors a way to... Read More
Have you ever wondered what challenges are faced by other... Read More
Like most average persons, I wanted some extra money to... Read More
RIVERSIDE, CA August 4, 2004 ?- "Historically, small business owners... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
Let's begin by setting some limits. If you're like me,... Read More
That's right. Your method, behavior and strategy you are now... Read More
How can we add Word Rich Content to our Websites... Read More
Recently, a friend asked "What's the deal with those DIY... Read More
You have permission to publish this article electronically, in print,... Read More
What is the point of having a website, you may... Read More
You work hard to build traffic to your web page.... Read More
Right after the thought, "I need a website," people usually... Read More
Functions and Subroutines in ASP If you read... Read More
So what do you do if need to get a... Read More
A lot has changed in the way sites are optimized... Read More
Recently I was reviewing the keyword specific conversion rate data... Read More
There are lots of HTML editors on the market, however,... Read More
I can't think of any business alive today that couldn't... Read More
Does My Web Site Require A Web Database?If your web... Read More
1. Upload robots.txt file in to your root directory and... Read More
So you've decided to start an online work at home... Read More
1. As the first step, "Hire a web designer."First create... Read More
Is Your Web Site an Expense or an Investment?Why don't... Read More
Antigo wedding limo ..A simple website stats counter is not enough if you... Read More
We all start out the same. Some have budgets, some... Read More
If you don't have a web site yet, are thinking... Read More
Although CSS layouts have been around for years, they haven't... Read More
The internet is a sea of knowledge. Getting your information... Read More
1. Upload robots.txt file in to your root directory and... Read More
When used to describe a web site, the term "sticky"... Read More
Does My Web Site Require A Web Database?If your web... Read More
Did you know that hosting companies overcrowd their servers despite... Read More
Have you ever thought the secret behind the success of... Read More
Huge Mistake #1: Creating a Website with Flash -- Did... Read More
Do you need a web site? Are you considering getting... Read More
QUESTION: Should I build and maintain my business Web... Read More
What is CSS?CSS is a simple file which controls the... Read More
One of the most important parts of establishing a new... Read More
You've just finished congratulating your marketing team. After six months... Read More
When marketing your website, it's important to know which of... Read More
When we review the sites of potential clients, there are... Read More
In a previous ezinearticles.com article,"I Need real visitors, Not Search... Read More
The first thing my business consultant (read brother-in-law) asked me,... Read More
"'Page Not Found' on this Server. Check the URL and... Read More
The popular search engine Google indexes over 8 billion websites.... Read More
When I set up my website I felt paypal was... Read More
Here's something you may never have thought of before:If I... Read More
Looks like every client wants a Flash site these days... Read More
Web Development |