문제

My problem is that the back button causes the browser to say something like "Page expired" when the previous page was created by a form.

Example:

  • page1: form submitted with search criterias ($_POST request, form points to page2)
  • page2: Receives $_POST request and show result (list of user with links, points to page3)
  • page3: Show user profile

Now when the visitor clicks the back button in the browser it will show something like "Page expired".

Instead the previous page should be shown with no warnings (page2, with the userlist)

How are your strategies to get around this behavior?

도움이 되었습니까?

해결책

If you are submitting a for with search parameters, you are trying to get some data, not modify some.

So, you should use the HTTP GET method, and not POST : POST should be used when you intend to create/modify data, and GET should be used when you intend to fetch some data.


Or, if you have some create/modify operation that has to be done :

  • The form first POSTs to a first page
    • That page does some operations (like writing something to a database)
    • And then redirects to another page, using a Location HTTP header.
  • It's that last page, that's queries by the browser using a GET requests, that displays the data fetched from the parameters received in the URL.

See the Post/Redirect/Get page on wikipedia, about this.

다른 팁

SharePoint 목록의 열과 "워크 플로 조회"의 기능을 사용 하여이 작업을 수행했습니다."CCEmail 열이있는"wfcontactslist "목록을 만들었습니다. 참고 연결된 워크 플로우가있는 목록과 동일한 사이트 모음에 있어야합니다."CCEmail "열에서 둘 이상의 이메일을 가질 수 있습니다 (내그룹) 이메일을 세미 콜론으로 분리하여 저에게 보너스는 내 wfcontactslist를 편집하여 CC 그룹의 개인을 쉽게 변경할 수 있다는 것입니다. 에 도움이되기를 바랍니다.

Don't use POST for search. Search can safely be done with GET since it won't alter anything.

This applies to PHP and IE8.

Not only must you set cacheing to private, but you must remove the 4 cacheing headers and this can only be done with PHP 5.3. In PHP 5.2 you can only set the 4 headers to blank values if using the Zend Framework's setHeader() method. For some reason is not sufficient on IE8 to set the 4 header values to empty values. Here's the code for PHP 5.3:

    header_remove("Expires");
    header_remove("Cache-Control");
    header_remove("Pragma");
    header_remove("Last-Modified");

You can use session to do this.

eg.

$_SESSION['name'] = $_POST['name'];

Remeber to unset your variables after the process is completed to optimize memory usage.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top