Question regarding $this->input->post() and checkboxes |
[eluser]RS71[/eluser]
I'm currently making a form but I'm having some trouble adding a check box. The check box doesn't return a value unless it is checked, right? If I use $this->input->post(), will it give me an error if there is no check in the box (no check box value present in POST) or will it return false or something?
[eluser]Ivan A. Zenteno[/eluser]
Are you sure using this syntax $this->input->post("check_box_name") ? The user guide http://ellislab.com/codeigniter/user-gui...input.html
[eluser]Ivan A. Zenteno[/eluser]
Are you sure the name input tag is the same? if you print_r($_POST) what is the output?
[eluser]nikefido[/eluser]
How are you naming your checkboxes? If you have multiple checkboxes with the same name, you typically name them something like name="myCheckBox[]" This then returns an array which you can use to gather all the values of that set of checkboxes. Perhaps you're getting an empty array back?
[eluser]Unknown[/eluser]
Thanks nikefido - I was having the same problem, but adding the [] to the checkbox names fixed it for me. |
Welcome Guest, Not a member yet? Register Sign In |