Home >Backend Development >PHP Tutorial >Solution to form data loss after php history.back returns, history.back_PHP tutorial

Solution to form data loss after php history.back returns, history.back_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:52:261006browse

The solution to the loss of form data after php history.back returns, history.back

The main reason why js uses history.back to return form data is the use of session_start(); For this reason, this function will force the current page not to be cached. This article introduces to coders the solution to the loss of form data after php history.back returns. Interested coders can refer to it.

The solution is as follows:

Add header("Cache-control: private") after your Session_start function; Note that your PHP program cannot have any output before this line.

There is also a session-based solution, add

before session_start

session_cache_limiter('nocache');//Clear the form
session_cache_limiter('private'); //Do not clear the form, only while the session is in effect
session_cache_limiter('public'); //Do not clear the form , as if session is not used

Original address: http://www.manongjc.com/article/823.html

Related reading:

The code to submit the php $_PHP_SELF form to the current page

Solution to the loss of return form data after php form submission

How to use php combined with js to submit forms to multiple pages

php form submitted to current page instance

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1126526.htmlTechArticleSolution to form data loss after php history.back returns, history.back js uses history.back to return form data The main reason for the loss is the use of session_start();, which function...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn