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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
"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 |
|
|||
|
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. |
|
|||
|
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/ |