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
Failure, just like success, is measured differently by each and... Read More
Building a new website can be a lengthy task. From... Read More
1. The first page appears quickly.It's a good way to... Read More
Some left shoes are in isle 5, while the right... Read More
So you have a good idea for a business and... Read More
As increasing numbers of people search for information on the... Read More
After years of working with entrepreneurs who developed their first... Read More
If you like the Internet and surfing through the billions... Read More
Is Your Web Site an Expense or an Investment?Why don't... Read More
When people think about the Internet, they think about technology.... Read More
"I have a small business with just a couple of... Read More
With the New Year upon us yet again, it's time... Read More
The definition of the phrase "Content Management" depends on what... Read More
You've just finished congratulating your marketing team. After six months... Read More
The "robots" meta tag, when used properly, will tell the... Read More
Most people know they need a website in order to... Read More
What is SQL? SQL stands for Structured Query Language and... Read More
If one more business owner tells me their website sucks... Read More
Server Side Includes (SSI) with ASP People often... Read More
Before you jump into spending coutnless hours on designing and... Read More
As a business you can't afford to ignore the Internet... Read More
If your company own one or more stores, you might... Read More
Are bloated images slowing down your web site and causing... Read More
Rosalind wants to share her inspirational poetry with a wider... Read More
It is an undeniable fact that not everybody is keen... Read More
family-safe home cleaners Arlington Heights ..We all start out the same. Some have budgets, some... Read More
Failure, just like success, is measured differently by each and... Read More
Mini Websites are the most powerful and cost effective solution... Read More
Fantastico is a 3rd-party cPanel add-on and can be purchased... Read More
Webmasters deal with a myriad of complex design challenges every... Read More
It never ceases to amaze me how many people set-up... Read More
Functions and Subroutines in ASP If you read... Read More
You've just finished congratulating your marketing team. After six months... Read More
Just like all things in life, the ways to run... Read More
If one more business owner tells me their website sucks... Read More
Succeeding with an eCommerce website is a dream for many... Read More
There was a time not long ago when setting up... Read More
I recently helped my mom to launch a website (www.mom2me.com)... Read More
After years of working with entrepreneurs who developed their first... Read More
The growth in Internet usage around the world is astounding... Read More
Server Side Includes (SSI) with ASP People often... Read More
When a user signs up at your website, you may... Read More
Writing for the web is totally different to writing for... Read More
If you are like me you have wanted to build... Read More
That's right. Your method, behavior and strategy you are now... Read More
Three way linking and concerns.For many years SEO experts were... Read More
Every business needs to know how it is doing. That's... Read More
The first thing my business consultant (read brother-in-law) asked me,... Read More
When I set up my website I felt paypal was... Read More
Now that you have got your domain name registered, your... Read More
Web Development |