A workaround for returning data disappears after a PHP form submission error, PHP form
This article to the Code farmers to introduce the PHP form submitted errors after the return of data to solve the problem, interested in the code farmers can refer to.
Return data disappears after a form submission error what to do now, analyze and solve this problem today.
Overview of the situation:
When you fill out the form information to submit a problem is that when the user fills in and submits the form, the program determines that it does not meet the requirements and returns, and returns the information that was filled out before the form is emptied. If you fill in the amount of information is not the matter, if the amount of information to fill more, this will directly hit the person to fill in the good mood. Therefore, the problem of resolving the content that is filled out after the form submission error is returned is an urgent problem to improve the user experience.
For this problem, the general summary of the following several situations:
(1) The page uses the Session_Start function, this function has a feature is to force the current page is not refreshed, the workaround is to add the following code after this function:
Header ("Cache-control:private"); //
There are several other solutions that are preceded by the Session_Start
Session_cache_limiter // session_cache_limiter//session_cache_limiter//
The above settings session will cause the seesion to appear cache, which causes the session information can not be updated when you apply to the session, for this reason, this article proposed the following several other solutions.
(2) using the header method to set the message header Cache-control, add the next segment code on the page:
Header (' Cache-control:private, Must-revalidate '); // Support page Bounce, note that we cannot have any output before
(3) using the Session_cache_limiter method, add the next segment code to the page:
Session_cache_limiter //
Here are some additional notes for the Cache-control message header field:
CACHE-CONTROL Specifies the caching mechanism that requests and responses follow. Setting Cache-control in a request message or response message does not modify the caching process in another message processing process. The cache directives for the request include No-cache, No-store, Max-age, Max-stale, Min-fresh, only-if-cached, and the instructions in the response message include public, private, No-cache, No-store, No-transform, Must-revalidate, Proxy-revalidate, Max-age. The instructions in each message have the following meanings:
Public : indicates that the response can be cached by any buffer.
Private: indicates that the entire or partial response message for a single user cannot be shared with the cache. This allows the server to simply describe a partial response message for the user, and this response message is not valid for another user's request.
No-cache: indicates that the request or response message cannot be cached
No-store: used to prevent important information from being inadvertently released. Sending in the request message will make the request and response messages do not use the cache.
Max-age: indicates that the client can receive a response that has a lifetime of not greater than the specified time (in seconds).
Min-fresh: indicates that the client can receive a response time that is less than the current time plus the specified time.
Max-stale: indicates that the client can receive a response message that exceeds the timeout period. If you specify a value for the Max-stale message, the client can receive a response message that exceeds the specified value for the timeout period.
After reading this article you will encounter similar problems can be completely solved, especially to remind that this solution is only for the PHP site, can remember.
Original address: http://www.manongjc.com/article/600.html
Related reading:
PHP implementations receive multiple form data instances with the same name but value
PHP get form data instance sharing
PHP a complete Form validation instance
Two ways to submit form forms in PHP
JQuery formvalidator Form Validation
jquery A simple form validation instance
PHP prevents forms from repeating submissions several ways
JS Form form onsubmit Event usage detailed
jquery a complete no-refresh Ajax Submission Form instance
jquery submits form forms using Ajax
PHP simulates post submission with curl
PHP via Fsockopen demo Form post submission
PHP form $_post[] instance application
Share a JavaScript generic method that verifies whether a form is empty
PHP form submitted to this page
Several ways that JavaScript gets form elements
JavaScript a complete Form validation instance
Use JS to submit form form
Form instance application in PHP
http://www.bkjia.com/PHPjc/1115253.html www.bkjia.com true http://www.bkjia.com/PHPjc/1115253.html techarticle PHP form submission error After returning data disappear problem resolution, PHP form this article to the Code farmers to introduce the PHP form submitted errors after the return data disappear problem solution, interested in ...