[eluser]nohbahdii[/eluser]
Hello,
I have a lengthy form and the elements are named in the following pattern
Code:
<input type="text" name="container[element]" value="" />
How do I write validation rules for these elements?
This is what I have in the controller so far
Code:
$rules = array(
'applicant[first_name]' => 'required'
);
$fields = array(
'applicant[first_name]' => 'First name'
);
$this->validation->set_rules($rules);
$this->validation->set_fields($fields);
.
.
.
if($this->validation->run())
{
// $this->db->insert('container', $this->input->post('container', true));
$this->db->insert('containers', $this->input->post('container', true));
$this->load->view('container/success');
} else {
redirect('container/add');
}