Here is my flow:
Form A post data to input.php as B
If data is invalid, B send data and error code into cookie and redirect to referer url (now is Form A)
Form A read data, error code in cookie, restate the form and display error message. The last thing is delete the cookie.
My problem is: How I still keep this 开发者_运维知识库flow if form data too heavy, because cookie size is limited.
You can't. A cookie is limited to 4Kb. The only option you have is to store the data in a cache, or database (with an ID), and send that ID to back in the cookie.
When you redirect to your Form A, you can then re-read the data from the cache or database with the ID from the cookie.
you could also have the form submit to the same page. Then you eliminate the problem of redirecting between pages and struggling to persist the data.
精彩评论