473,507 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Submit vs. a fresh page load

I'm developing a page - mostly for the learning experience - that
includes a form with several text fields and a submit button. When
it's submitted, there is some server-side processing and the output is
displayed as part of the same page. (the form's action attribute is
set to: "<?php $PHP_SELF ?>").

One of the steps in the PHP script is to check for the existance of a
hidden element in the form so that I know whether the page is being
sent out as a result of a new request or from the form having been
submitted.

This all works as expected. When the page is sent out as a result of
having been requested from its "home" page, the results are not shown;
when the submit button is clicked, the page is sent out with the
results shown.

Finally my question: when viewing the page with the results shown, if
I press <F5> or click on "Refresh", it behaves as if I had clicked the
Submit button (that is, it shows the results). I would expect it to
return the page as if it was a new request (and NOT show the results).

Am I doing some wrong here or is that the way IE works?
Jul 17 '05 #1
2 2266
Martin <Martin <ma**********@comcast.net>> wrote:
Finally my question: when viewing the page with the results shown, if
I press <F5> or click on "Refresh", it behaves as if I had clicked the
Submit button (that is, it shows the results). I would expect it to
return the page as if it was a new request (and NOT show the results).

Am I doing some wrong here or is that the way IE works?

It's not only how IE works, but how *ALL* browsers should work.
By clicking "Refresh", you want to reload the *current* page, which is the
result from sending the post data to the form. To do this, the IE (as every
other good browser) sends out exactly the same post data it sent for the
original request. Therefore you can't distinguish between a reloaded page
and a normal request with the same post data.

One possible solutions would be to save the data on the server, then
forwarding the user to another page, which displays the data.
Another solution would be putting an unique id into a hidden field and
saving it into a database and check whether the id is in the db, whenever
you recieve the form. If it is in the db, process the form data and remove
the id from the database, otherwise ignore the form data. (Don't forget the
error message so the user may obtain a "fresh" id.)

--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #2
Martin wrote:
<cut>
Am I doing some wrong here or is that the way IE works?


I believe that IE even asks "Do you want to resent tehe information", or
something like that :-)
Basicly its up to the browser what to do because it can simply fetch the
page or resend your POST data.

gordan
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9627
by: HH | last post by:
I'm learning to design web applications with php, mysql, and apache from a book. I copied a sample application called guestbook 2000 that came with the CD in the book to my htdocs folder, but...
8
3033
by: Matt | last post by:
I want to submit the form to the server without opening another page. When we do the following, it will submit the form data in myform to the IIS, and open page2.asp. <form name="myform"...
2
18281
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I...
2
3799
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
3
2549
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: ...
3
1734
by: Robin | last post by:
Hi, I have a question: If I have a frameset, frame1 and frame2. On frame2 I have a datagrid, on which I can add/update/delete rows. If I submit that page, I catch these changes in events and...
3
2418
by: Dabbler | last post by:
How do I tell wether I'm seeing autopostback vs submit button click in Page_load? Thanks for any clues.
5
1897
by: Alex | last post by:
Hello, I hope I can explain this properly. I'm writing an application with a tabbed-based navigation, and a form which gets filled out by users will be split into 5 subtabs. What I need is...
5
10302
by: Rider | last post by:
Hi All, Here is the reason why i ak asking for ur help. I have a edit form in which the values already stored in DB are populated. User can edit some or all the values in the form. then he...
0
7223
marktang
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,...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7034
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...
0
7488
tracyyun
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...
0
5623
agi2029
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,...
0
4702
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.