By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,939 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,939 IT Pros & Developers. It's quick & easy.

Pressing browser back button - form filled data disappeared

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.