I have a number of forms that do significant work based on variables
POSTed from the form. What is the common method of detecting and
preventing this work from being done when the form is POSTed as the
result of the user clicking the Back or Reload buttons in the browser?
--Bruce 5 4594
"Bruce" <bv***************@mailblocks.com> wrote in message
news:3t********************************@4ax.com... I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as the result of the user clicking the Back or Reload buttons in the browser?
--Bruce
You could give it a form action of, say, "formhandler.php". On
formhandler.php, handle the information from the form (naturally), then send
the user via header("Location: ...") to "success.php", which displays some
message like "The data was successfully submitted." The back button will
then send them to the original form, and the refresh button will just
refresh the success message. Either way, the form won't be re-POSTed.
If the data from the form needs to be immediately displayed, then save the
data from formhandler.php into $_SESSION variables and send a location
header to your display page.
- JP
I guess the problem occurs when I need to display the same page again,
like when I delete a line item in a list of items, or click on a link
to send a stock e-mail to someone.
--Bruce
On Sat, 04 Sep 2004 23:45:32 GMT, "kingofkolt"
<je**********@comcast.net> wrote: "Bruce" <bv***************@mailblocks.com> wrote in message news:3t********************************@4ax.com.. . I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as the result of the user clicking the Back or Reload buttons in the browser?
--Bruce
You could give it a form action of, say, "formhandler.php". On formhandler.php, handle the information from the form (naturally), then send the user via header("Location: ...") to "success.php", which displays some message like "The data was successfully submitted." The back button will then send them to the original form, and the refresh button will just refresh the success message. Either way, the form won't be re-POSTed.
If the data from the form needs to be immediately displayed, then save the data from formhandler.php into $_SESSION variables and send a location header to your display page.
- JP
"Bruce" <bv***************@mailblocks.com> wrote in message
news:0f********************************@4ax.com... I guess the problem occurs when I need to display the same page again, like when I delete a line item in a list of items, or click on a link to send a stock e-mail to someone.
--Bruce
On Sat, 04 Sep 2004 23:45:32 GMT, "kingofkolt" <je**********@comcast.net> wrote:
"Bruce" <bv***************@mailblocks.com> wrote in message news:3t********************************@4ax.com.. . I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as the result of the user clicking the Back or Reload buttons in the browser?
--Bruce
You could give it a form action of, say, "formhandler.php". On formhandler.php, handle the information from the form (naturally), then
sendthe user via header("Location: ...") to "success.php", which displays
somemessage like "The data was successfully submitted." The back button will then send them to the original form, and the refresh button will just refresh the success message. Either way, the form won't be re-POSTed.
If the data from the form needs to be immediately displayed, then save
thedata from formhandler.php into $_SESSION variables and send a location header to your display page.
- JP
In that case (if I understand your problem), you can still use the same form
action ("formhandler.php"), and from there, header() the user back to the
original page s/he was viewing. The page will then be updated with the new
(or deleted) records.
- JP
"Bruce" <bv***************@mailblocks.com> wrote in message
news:0f********************************@4ax.com... I guess the problem occurs when I need to display the same page again, like when I delete a line item in a list of items, or click on a link to send a stock e-mail to someone.
--Bruce
On Sat, 04 Sep 2004 23:45:32 GMT, "kingofkolt" <je**********@comcast.net> wrote:
"Bruce" <bv***************@mailblocks.com> wrote in message news:3t********************************@4ax.com.. . I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as the result of the user clicking the Back or Reload buttons in the browser?
--Bruce
You could give it a form action of, say, "formhandler.php". On formhandler.php, handle the information from the form (naturally), then
sendthe user via header("Location: ...") to "success.php", which displays
somemessage like "The data was successfully submitted." The back button will then send them to the original form, and the refresh button will just refresh the success message. Either way, the form won't be re-POSTed.
If the data from the form needs to be immediately displayed, then save
thedata from formhandler.php into $_SESSION variables and send a location header to your display page.
- JP
In that case (if I understand your problem), you can still use the same form
action ("formhandler.php"), and from there, header() the user back to the
original page s/he was viewing. The page will then be updated with the new
(or deleted) records.
- JP
Hello,
On 09/04/2004 08:27 PM, Bruce wrote: I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as the result of the user clicking the Back or Reload buttons in the browser?
You may want to try this class that lets you specify a message that
appears on alert box when the users tries to submit the same form again.
It does not stop an user from submitting the same form again if he
really wants, but it prevents that many nervous users submit the same
form again by accident, which in my experience happens quite often: http://www.phpclasses.org/formsgeneration
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: CJM |
last post by:
How do people go about preventing the user from submitting a form for a 2nd
time? For example, the user submits a form, clicks on the back button, and
the submits the form again.
I have used...
|
by: Galahad |
last post by:
Here's the question:
I have a form w/ TextBox controls and a Search Button control. Once the user
clicks the Search Button, they get a Modal dialog w/ a datagrid that contains
their search...
|
by: Ravi |
last post by:
Hi,
I have a simple .aspx page where user enters data (e.g Name address,
etc). At the end, he/she clicks Save button which Posts to the same page and
in the Save button's click event I am saving...
|
by: Diane Selby |
last post by:
Hi-
I am developing an ASP.NET application that can take a few seconds to
process the request from the user. We are looking for a client-side
solution that will prevent users from resubmitting...
|
by: Brian Henry |
last post by:
I have two list boxes on my form... lstCanSend and lstRecipients... well
then there are two buttons add and remove between them (your basic select
and pick listing) which uses java script to move...
| |
by: guoqi zheng |
last post by:
In a regular html form, when user press "enter" key, the form will be
submitted.
However, in ASP.NET web form, a form will only be submitted (post back) when
a special button is clicked. Many...
|
by: Oleg Konovalov |
last post by:
Hi,
I have a Java GUI application where I perform a lot of long DB operations
,
which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and clicks...
|
by: Oleg Konovalov |
last post by:
Hi,
I have a Java/JavaScript GUI application where I perform a lot of long DB
operations
, which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and...
|
by: noneya22 |
last post by:
I'm using asp.net 2.0. I have a page that has a save button and a
cancel button along with a text field. All controls are asp.net
server controls. I have JavaScript that prompts the user if he...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |