开发者

Store User Input Data For 24 Hours With PHP

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:

  1. Run a cron job that deletes the old records
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜