I must know..
is
$this->form_validation->set_value('first_name')
the same as
$this->input->post('first_name')
?
They both seem to get the input value. Is the first one more secure if I'm validating inputs?
set_value()
can return a default value if one is set in the second parameter, and will not return anything if the field was not validated with the Form Validation library, whereas $this->input->post()
will return the $_POST
value even if the field was not processed by the validation lib.
Both functions will return the modified value if "prep" rules have been run on the input.
When you want to read a post value, just use $this->input->post()
, the set_value()
type functions like set_select()
and set_checkbox()
will actually return something like selected="selected"
rather than the actual input value, so this won't work for checkboxes, radios, and selects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With