[eluser]CarNinja[/eluser]
[quote author="dobbler" date="1220533060"]Hi CarNinja,
This didn't make any sense to me either. The form fields should look like this:
<INPUT type="CHECKBOX" name="itemtype[]" value="1" /><br />
<INPUT type="CHECKBOX" name="itemtype[]" value="2" /><br />
<INPUT type="CHECKBOX" name="itemtype[]" value="3" /><br />
Then try print_r($_POST); and you should get an array of the values.. They have to be checked though.
The name of the input being an array threw me, I came from an ASP background so this was confusing but it worked so I'm not asking any questions!
Hope this helps, it was driving me mental so I feel your pain..
Rob.[/quote]
Thanks Rob,
I actually found the solution a few moments ago. I'll post it here for future reference:
When adding the field to the page, it needs the brackets, as you've pointed out.
Code:
<?= form_dropdown( 'ad_states[]', $states, $this->input->post( 'ad_states' ), 'id="ad_states" multiple="multiple" tabindex="8"' )?>
However, when you access the variable, you drop the brackets:
Code:
$this->input->post( 'ad_states' )
I hope this clears anything up for people searching in the future.