1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
$this->load->library('form_validation');
$data = [ '_id' => $this->input->get("_id"), 'name' => $this->input->get("name"), 'covers' => $this->input->get("covers"), ];
$this->form_validation->set_data($data);
$config = [[ 'field' => '_id', 'rules' => 'required' ], [ 'field' => 'name', 'rules' => 'required' ], [ 'field' => 'covers[]', 'label' => 'cover', 'rules' => 'required' ]];
$this->form_validation->set_rules($config); if ($this->form_validation->run() === false) { return $this->form_validation->error_array(); }
|