Home >Backend Development >PHP Tutorial >Solution to form data loss after php history.back returns, history.back_PHP tutorial
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_startsession_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