bert56 Posted May 26, 2014 Share Posted May 26, 2014 In my form you can only save at the end.to the database. Is it possible to make it autosave on harddisk alsotoets.php? Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/ Share on other sites More sharing options...
ginerjm Posted May 26, 2014 Share Posted May 26, 2014 Are you asking "how to do a file download"? Are you suggesting that your script automatically download a file onto a user's hard drive? Seems like a script I wouldn't want to be running on my machine if it is going to be putting things on my drive. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480931 Share on other sites More sharing options...
davidannis Posted May 26, 2014 Share Posted May 26, 2014 From looking at the script it looks like the form is very long so I think the OP wants the user to be able to suspend in the middle and come back to complete the form. Is that right? Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480936 Share on other sites More sharing options...
ginerjm Posted May 26, 2014 Share Posted May 26, 2014 I think the approach should be to provide a button to do that but do it on the server. Maybe create a table to hold the form element values and some kind of key for the user to provide in order to return to work. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480937 Share on other sites More sharing options...
bert56 Posted May 26, 2014 Author Share Posted May 26, 2014 Isn't it possible to make an autosave each five minutes on the server or on an extra table? The pupils does not have very much time to do other things than answer the questions. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480942 Share on other sites More sharing options...
ginerjm Posted May 26, 2014 Share Posted May 26, 2014 You could use JS to trigger a submit every so often. Or Ajax to push all the data to the server without disturbing the user. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480946 Share on other sites More sharing options...
bert56 Posted May 26, 2014 Author Share Posted May 26, 2014 What is the easiest way, Javascript or Ajax? I have to read about it how it works, because I never used such code. Do you have a hint for me? Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480956 Share on other sites More sharing options...
ginerjm Posted May 26, 2014 Share Posted May 26, 2014 Why not simply make the form shorter and let them take a break between multiple input pages? Then you can simply use one script to collect all the data (in batches) and store it in a table or session array and post it when the process is complete. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480964 Share on other sites More sharing options...
bert56 Posted May 27, 2014 Author Share Posted May 27, 2014 I try to understand the information. 1 I think when I store the data in a table it will take more time than when I store it in a session array. 2 When there is no electricity for a moment the data in the table will be saved, but the data in the session array will be gone. 3 An autosave is quicker, I think, but not possible in PHP, only in Ajax or JavaScript. But when we have problems with electricity, the data will be saved. The problem is that it is very difficult to handle. Did I understand the three points correctly? So I can better break the form in four input pages and post it in different tables. But when there is a problem with electricity the pupils have to make one input page again? That does not make them happy, but it will be. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1480983 Share on other sites More sharing options...
Solution ginerjm Posted May 27, 2014 Solution Share Posted May 27, 2014 Are you that worried about electricity outages where you are? Data saved in the session or in the db will be saved since both are at the server, not at your clients. And yes - if the data is saved in either you can re-build the input for the users from either the session or the db. From what you are saying this form is so long it takes the users too much time to complete and you must be worried that the clients will 'time out' and lose everything they are working on . To me that indicates that I need to build my pages differently. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1481011 Share on other sites More sharing options...
cyberRobot Posted May 27, 2014 Share Posted May 27, 2014 (edited) Have you looked into Local Storage? http://www.smashingmagazine.com/2010/10/11/local-storage-and-how-to-use-it/ Note that I haven't used this option myself. I've only seen it used by third-party solutions like JotForm. Edited May 27, 2014 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1481016 Share on other sites More sharing options...
bert56 Posted May 27, 2014 Author Share Posted May 27, 2014 Thank you, I do it also. Quote Link to comment https://forums.phpfreaks.com/topic/288779-autosave/#findComment-1481027 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.