AdRock Posted February 17, 2007 Share Posted February 17, 2007 I have a form on my website which is a contact form. I have validation where if a filed is blank an error message is displayed but I have nothing to store what data has been entered so when the user has to go back and fill in the blank field, all the other data has beeen erased. I am trying to find out the best way to store the data temporarily until the user has entered all fields before clicking the submit button. What would be the best way to do this........cookies or sessions? Link to comment https://forums.phpfreaks.com/topic/38841-cookies-or-sessions/ Share on other sites More sharing options...
fert Posted February 17, 2007 Share Posted February 17, 2007 sessions Link to comment https://forums.phpfreaks.com/topic/38841-cookies-or-sessions/#findComment-186766 Share on other sites More sharing options...
printf Posted February 17, 2007 Share Posted February 17, 2007 neither, why, because if there are errors you should return the form refilled in with the data that didn't have errors. You don't need a session or a cookie to do that, if your form processing logic is self contained, (IE: using the same script as the form process segment of your application). Cookies and sessions are great, but there is a time when and when not to use them, because you can't control them if the user restricts you, that's why sessions is best for a login controlled application. Sure you can do what you want, but for a trivial form process, the error control should be script based! printf Link to comment https://forums.phpfreaks.com/topic/38841-cookies-or-sessions/#findComment-186769 Share on other sites More sharing options...
printf Posted February 17, 2007 Share Posted February 17, 2007 I went to fix my post and pressed the wrong button, sorry! Link to comment https://forums.phpfreaks.com/topic/38841-cookies-or-sessions/#findComment-186770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.