dimanche 22 mars 2015

return True after the validation of all fields

please i work on codeigniter using my helper to validate forms using foreach loop.


my question is how can i return TRUE if all fields are valids


this is my code :


function validate($form){ $ci =& get_instance(); $list = $ci->config->config; foreach($form as $key => $value){ if(array_key_exists($key, $list)){ $ci->form_validation->set_rules($key, "lang:form_$key", $list[$key]); if($ci->form_validation->run() == false) return form_error($key); // in case of error } } }


Aucun commentaire:

Enregistrer un commentaire