• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way for getting form values

#1
[eluser]ojcarga[/eluser]
Guys,

Just wondering if you can explain me the difference between these two way for getting values on form submission:

Code:
$this->form_validation->set_value('login')

&&

Code:
$this->input->post('login')

Both works perfectly but dont know which is the difference.

Thanks,
Cheers!

#2
[eluser]LuckyFella73[/eluser]
"set_value" is used when repopulating form values
in case the form_validation failed. You echo it
in the "value" attribute of your form field.

To get the submitted form data and process it in
your controller use
Code:
$my_value = $this->input->post('name_form_field');

#3
[eluser]ojcarga[/eluser]
Thanks,

yeah, that's the way I do it but checking the Tank_auth code I just realized that it does it (catch values in the controller after form submission) using the first one method:
Code:
$this->form_validation->set_value('login')

I'm just asking cause really don't know if doing it that way gain/lose something, i don't know.

Cheers!

#4
[eluser]LuckyFella73[/eluser]
Code:
$this->form_validation->set_value('login')

Afaik this line is just to SET the value. If you look
at the code in tank auth it's not processed furthermore.
I don't know why he had this at all because if you run
the form_validation all values of the fields defined in
the rules are set automatically.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.