ShaolinF Posted December 15, 2009 Share Posted December 15, 2009 Hi Guys I am trying to handle error messages for my form. Is there any way I can 'temp' store error messages ? Like they will only work once and then go blank ? Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/ Share on other sites More sharing options...
phpfan101 Posted December 15, 2009 Share Posted December 15, 2009 depends on what you mean by store? Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978096 Share on other sites More sharing options...
phpfan101 Posted December 15, 2009 Share Posted December 15, 2009 i would go with mysql in any case Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978098 Share on other sites More sharing options...
mikesta707 Posted December 15, 2009 Share Posted December 15, 2009 I don't really understand what you mean by temp story error messages? Common practice is to store them in an array like so $error = array(); if (some error){ $error[] = "Some error message"; } //so on Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978099 Share on other sites More sharing options...
ShaolinF Posted December 15, 2009 Author Share Posted December 15, 2009 Ok, so if for example I have page1.php which has a form. page2.php validates page1 fields and redirects the user back to to the page1 if errors are found. I was thinking of storing the errors in a session but then if the user comes back at a later time and hasnt closed his session he will still see the errors. What workarounds are there to this problem ? Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978106 Share on other sites More sharing options...
phpfan101 Posted December 15, 2009 Share Posted December 15, 2009 Just a small questions... why are you even storing the info? (trying to atleast) Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978115 Share on other sites More sharing options...
ShaolinF Posted December 15, 2009 Author Share Posted December 15, 2009 well, I need some way to get the data errors msgs from page2.php back to page1.php - The closest I can think of is flash_data for code igniter. Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978141 Share on other sites More sharing options...
teamatomic Posted December 16, 2009 Share Posted December 16, 2009 $_SESSION['array'] = $array; When you rerun the form with the errors somewhere ~after~ the form simply do $_SESSION['array'] = ''; HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/185288-form-validation/#findComment-978156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.