PHP “Document Expired” after using the back button

前端 未结 2 421
悲哀的现实
悲哀的现实 2020-12-22 07:41

I have a form where I am filing some informations in a wizard. This page is reaching by POST and displayed with Smarty. Once I filed all the informations in, I am using anot

相关标签:
2条回答
  • 2020-12-22 08:16

    http://en.wikipedia.org/wiki/Post/Redirect/Get

    In my opinion, you should do this for every POST, at least in production.

    Small example:

    if ('GET' == $_SERVER['REQUEST_METHOD']) {
       //display view
    }
    else if ('POST' == $_SERVER['REQUEST_METHOD']) {
       //process input
       //update session
       header('Location: /next/page/to/view', true, 303);
    }
    

    EDIT: Want to point out that this old post was referring to browser submissions. In a RESTful web service you would likely respond with a 201 for POST.

    0 讨论(0)
  • 2020-12-22 08:36

    Everything is correct. When you push BACK on your Page 3 you are actually trying to go to previous page - this page is generated as a reply to bowser's POST request. To view this page new POST request should be sent and page would be generated relying on POST data.

    0 讨论(0)
提交回复
热议问题