I'm trying to post my form by method="GET"
instead of POST
.
Codeigniter's form_validation->run()
doesn't work.
It's not returning any form_error
in view page.
I'm trying to post my form by method="GET"
instead of POST
.
Codeigniter's form_validation->run()
doesn't work.
It's not returning any form_error
in view page.
If you have to use $_GET
, you could set the validation data before the validation rules :
$this->form_validation->set_data($_GET);
The concept of form_validation is based on the use POST, as the form validation function form_validation->run()
builds its validation array with POST.
see Codeigniter public function run()
at around line 417 of system/libraries/Form_validation.php
:
$validation_array = empty($this->validation_data) ? $_POST : $this->validation_data;
but as pointed out in the answer of @Hasta Dhana, you can use $_GET or any other array like:
$this->form_validation->set_data($_GET);
if you want to validate an array that does not originate from $_POST data. This array takes then the place of $this->validation_data
in the if clause