CodeIgniter Forums

Full Version: Repopulating Arrays of checkboxes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I've looked through the forums and other than modifying certain core files there seems to be no fix that is up to date ... meaning I haven't found one that wasn't over 2 years old. I have an array of check boxes representing towns a person could work in ... example ...

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Cape Cod"<?php echo set_checkbox('coverage_areas[]', 'Cape Cod');?>/>Cape Cod

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Boston"<?php echo set_checkbox('coverage_areas[]', 'Boston');?>/>Boston

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Providence"<?php echo set_checkbox('coverage_areas[]', 'Providence');?>/>Providence

the only validation id do on this is the

$this->form_validation->set_rules('coverage_areas', 'Coverage Areas', 'required);

when the form is submitted and an error occurs the check boxes that were checked are not repopulated ... anyone got any ideas, as I said I've pretty much tried everything I came across.

El Forum

I solved it ... just an oversite ....

it was my validayion call ...

$this->form_validation->set_rules(‘coverage_areas’, ‘Coverage Areas’, ‘required);

should be ...

$this->form_validation->set_rules(‘coverage_areas[]’, ‘Coverage Areas’, ‘required);

array !!