473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Pressing browser back button - form filled data disappeared

Hi there,

When filling out a web form on a php page that is submitted to a search
which lists the results based on the criteria provided (in the form), all
works fine and as expected.

However, when I press the back button to amend the form all of the search
criteria data has gone and I have to fill it all out again if I want to do a
similar search which is frustrating. (This does not actually happen in
Firefox browser but most of my users will be using IE). How can I prevent
this from happening?

Previously I made a post about avoiding "Page has expired" and the
conclusion I came to for that was not to use a "POST" which did the trick.
But now I want to retain the data I input?

How can I do it?

Kind regards

Dave.
Jul 17 '05 #1
4 5723
NC
Dave Smithz wrote:

When filling out a web form on a php page that is submitted to a search which lists the results based on the criteria provided (in the form), all works fine and as expected.

However, when I press the back button to amend the form all of the search criteria data has gone and I have to fill it all out again if I want to do a similar search which is frustrating. (This does not actually happen in Firefox browser but most of my users will be using IE). How can I prevent this from happening?


First of all, why not repeat the search form at the top of the search
results page? This way, no one will need to hit the back button to
change search terms. In fact, you may want to consider combining the
search form page and the search results page into a single page.
If $_POST is empty, just show the form. If it's not, show the form,
populate it with values, do the search based on those values and
display the results.

Alternatively, you can store the form values in a session variable and
retrieve them whenever necessary.

Cheers,
NC

Jul 17 '05 #2

"NC" <nc@iname.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
First of all, why not repeat the search form at the top of the search
results page? This way, no one will need to hit the back button to
change search terms. In fact, you may want to consider combining the
search form page and the search results page into a single page.
If $_POST is empty, just show the form. If it's not, show the form,
populate it with values, do the search based on those values and
display the results.
Nice idea, but the search form is HUGE. It is a page which is specifically
called FULL SEARCH, which allows them to do a detailed search on all DB
fields. OK I could split the page across frames or something, but also I
inherited this DB from a previous DB guy and want as minimal changes as
possible.
Alternatively, you can store the form values in a session variable and
retrieve them whenever necessary.


I think I have to investigate session variables a little bit more. Is there
a limit to the amount that can be used?

Still interested to know if there is a quick fix to my originally described
problem or more details as to when it occurs. I'm sure lots of websites
allow use of the back button and your previous content does not disappear.
Why does it in mine?

Regards

Jul 17 '05 #3
Dave Smithz (SPAMFREEWORLD) wrote:
: Hi there,

: When filling out a web form on a php page that is submitted to a search
: which lists the results based on the criteria provided (in the form), all
: works fine and as expected.

: However, when I press the back button to amend the form all of the search
: criteria data has gone and I have to fill it all out again if I want to do a
: similar search which is frustrating. (This does not actually happen in
: Firefox browser but most of my users will be using IE). How can I prevent
: this from happening?

: Previously I made a post about avoiding "Page has expired" and the
: conclusion I came to for that was not to use a "POST" which did the trick.
: But now I want to retain the data I input?

: How can I do it?
I have set up various forms in the past that worked that way in those
browsers that were popular when I tested the forms. (A form that does
anything else is very impolite if you ask me).

But I never had to _do_ anything to make this work, it simply worked that
way. I can't be sure now that I ever tested this in IE 6.0, so maybe IE6
is different.

Do you have some caching parameters set up that prevent the browser from
doing this, or some kind of javascript interaction going on that maybe is
emptying out the fields without you realizing it?


--

This space not for rent.
Jul 17 '05 #4
Dave Smithz wrote:
<snip>
Previously I made a post about avoiding "Page has expired" and the
conclusion I came to for that was not to use a "POST" which did the trick. But now I want to retain the data I input?

http://groups.google.com/gr*********...oglegroups.com

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #5

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

Similar topics

3
by: Ray Torres | last post by:
I would appreciate any help with the following problem. I have several different htm pages with (simalar) forms that are processed by the same PHP script. If there is data missing on the form,...
5
by: siliconmike | last post by:
Do most browsers retain form fillup memory of previous page ? That is when the user presses back button, the forms on the previous page come up filled. Comments? Thank you, Mike
2
by: Cindy | last post by:
Hi all you smarties out there, I'm having a little conundrum with my asp.net page Scenario: I have a form (asp.net) with no code behind (as yet). I have placed a javascript function on a...
2
by: Ersin Gençtürk | last post by:
I show errors as popup boxes via alert() but I write this scripts in header of html page.So if there is an error on the server side , in the next postback a popup shows the error via alert , this...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
4
by: jwlum | last post by:
I have the following problem under Internet Explorer only: 1. User fills out form data (myform.php) and clicks a button that fires myFunction() 2. myFunction() spawns a "hello, world" popup page...
1
by: User | last post by:
Hi, Are there ways to let browser forget about the previous submitted form data? Or prevent user from pressing F5 to submit the same form again Or prevent user from presising back on the...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am thinking about doing this since I got several cases that some of our internal users open more than one browser at the same time from our server. When one of the transactions was not...
2
by: =?Utf-8?B?SmVmZiBEb25rZXJzZ29lZA==?= | last post by:
I have a registration form that updates a province/state droplist when a country is selected from another droplist. When the user clicks the back button though, the province list goes back to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.