简体   繁体   中英

How to store data from a form written in HTML and JavaScript in a session or cookie using PHP to preload whenever the form is accessed

I need to be able to save the data from a form into a session or cookie. Im not sure which would suit me best. Basically I have this form that consists of a lot of questions. This form is intended for users to complete in multiple sessions. It would be ideal for the user to answer the questions and then be able to close out the form and when they return at a later date the previous answered questions will appear. Im not too knowledgeable about php session/cookies some advice or even a small example would be greatly appreciated. I will be using XAMP to be able to execute the php.

I've tried doing some research on how to implement this but. I have not gotten anywhere.

I would use the browser's local storage , reading out the storage with Javascript onload and saving your form data to the storage onbeforeunload .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM