I need to find a way to store users data that they have input into a form. It will be triggered by the user clicking a "save" button. At which point all of the data that they have input will be stored. When the user returns to the form they should be able to see their data in order to complete the rest of the form in order to submit the information. I want this data to be stored for 24 hou开发者_如何学Crs only after which point they will lose the data that they have already input.
If anybody has a method or any advice I will be grateful.
If you don't need the data on the server it would probably be easiest to store it on the client side using the HTML5 localStorage JavaScript API or alternatively cookies, if you need to support older browsers.
Simply have a column of time_created
and either:
- Run a cron job that deletes the old records
- At every HTTP request, execute a
DELETE
query that deletes old records (should be sufficiently fast when having index)
Store it in the session and set the session timeout to 24 hours.
精彩评论