472,328 Members | 967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 5645
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...
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...
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...
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...
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...
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()...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.