How do I validate a form field in Codeigniter when using Get parameters? How do I validate a form field in Codeigniter when using Get parameters? codeigniter codeigniter

How do I validate a form field in Codeigniter when using Get parameters?


For CodeIgniter 3, you can pass the GET array into the set_data function. For example:
$this->form_validation->set_data($this->input->get());


Just add:

$_POST['states'] = $this->input->get('states');

for validate states field in form validation just before

$this->form_validation->set_rules('states', 'states', 'required|trim');


This post on the Codeigniter Forum suggests that form validation does not work with Get Parameters and that is just the way Codeigniter is.