dimanche 22 mars 2015

return array when all form fields are ok

please i work on a project using Codeigniter i have created my helper function to validate form.


my question today is how can i return $form if all the form fields are ok


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) echo form_error($key); else // here he show me array if one of the field is not false // but i want to return $form if all the fields are ok } } }


Aucun commentaire:

Enregistrer un commentaire