Dear All, i made a file i.php containing a form and on submit it calls next.php which also hase a form. but if i click on the browsers back button then the previous data lost how can i solve this proble.

Sumit

    not neccessarily... are you using sessions?

    I have been working on a new site and it uses sessions and when you hit the back button the page reloads and that clears any forms... Its not even being cached in the browser... something to do with HTTP headers...

    I've tried changing php.ini's session config to cache private but then I never get a fresh page even when I press ctrl+refresh...

    anyone else had this problem?

    I use IE 5 btw.

    Cheers,

    Stephen

      like if u fill in out a registration form in yahoo messanger then if u leave any field blank then it and u click on back button all the data is still there. but in php. is it possible do that just check on yahoo.

      sumit

        I know what you mean and its a problem with the page expiring too soon... Not necessarily with PHP - if you weren't using sessions it would be fine...

        I think php.net/header has some good info on caching and sending special HTTP headers to stop the page from expiring too soon...

        also look in your php.ini under the session config section - you can set caching to private...

          a month later

          Setting the caching to private fixes this.

            Alok: I tried that and it does work but then the pages are very stale even when I press ctrl-refresh I don't get a new version 🙁

            I did find a solution on php.net and that is to set the session.cache_limiter to equal nothing... ie: ""

            Then it works just like a normal PHP page without sessions ;-)

              10 months later

              Spyder,
              Can you be a little more specific about how you solved your caching problem? I have a similar problem and am looking for a solution. Perhaps you code post a code example?

              Thanks
              Bob

              Spyder wrote:

              I did find a solution on php.net and that is to set the session.cache_limiter to equal nothing... ie: ""

              Then it works just like a normal PHP page without sessions ;-)

                a month later

                I have the same problem with form caching.
                In php.ini specifying session.cache_limiter = nocache makes browser form clear all data when pressing back button.
                Pages not written in php code do not show these problem.
                So I tried <? header ("Cache-Control: public"); ?> on top of php code page.
                But had no effect.
                Then I tried in php.ini like session.cache_limiter =
                (specifying no value)
                and this acts good as I wished.

                  Write a Reply...