Home >Backend Development >PHP Tutorial >Solution to form data loss after php historyback returns krshistory history download history simple notation
The main reason why js uses history.back to return form data is because session_start(); is used. 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
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 the session is not used
Original address: http://www.manongjc.com/article/823.html
Related reading:
php $_PHP_SELF form is submitted to the current The code of the page
Solution to the loss of form data returned after the php form is submitted
php combined with js to implement the method of submitting the form to multiple pages
php form submission to the current page instance
The above introduces the solution to the loss of form data after php historyback returns, including the history aspect. I hope it will be helpful to friends who are interested in PHP tutorials.