Welcome Guest, Not a member yet? Register   Sign In
Question regarding $this->input->post() and checkboxes
#1

[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?
#2

[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
#3

[eluser]darkhouse[/eluser]
it would/should return false.
#4

[eluser]Ivan A. Zenteno[/eluser]
Are you sure the name input tag is the same?


if you print_r($_POST) what is the output?
#5

[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?
#6

[eluser]Unknown[/eluser]
Thanks nikefido - I was having the same problem, but adding the [] to the checkbox names fixed it for me.




Theme © iAndrew 2016 - Forum software by © MyBB