Pressing browser back button - form filled data disappeared

This is a discussion on Pressing browser back button - form filled data disappeared within the PHP Language forums, part of the PHP Programming Forums category; Hi there, When filling out a web form on a php page that is submitted to a search which lists ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-26-2005
Dave Smithz
 
Posts: n/a
Default 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.


Reply With Quote
  #2 (permalink)  
Old 04-26-2005
NC
 
Posts: n/a
Default Re: Pressing browser back button - form filled data disappeared

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

Reply With Quote
  #3 (permalink)  
Old 04-26-2005
Dave Smithz
 
Posts: n/a
Default Re: Pressing browser back button - form filled data disappeared


"NC" <nc@iname.com> wrote in message
news:1114472579.407493.302790@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



Reply With Quote
  #4 (permalink)  
Old 04-26-2005
Malcolm Dew-Jones
 
Posts: n/a
Default Re: Pressing browser back button - form filled data disappeared

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.
Reply With Quote
  #5 (permalink)  
Old 04-26-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Pressing browser back button - form filled data disappeared

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/groups?as_u...oglegroups.com

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:16 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0