08-07-2012, 05:01 AM
[eluser]michalsn[/eluser]
Validation:
Static array sample:
Dynamic array sample:
View:
Validation:
Code:
$this->form_validation->set_rules('is_active', 'Is active', 'required');
Code:
$is_active_dropdown = array(
NULL => 'Select one...',
0 => 'No',
1 => 'Yes'
);
Code:
$query = $this->db->get('is_active_dropdown');
$data[0] = 'Select one...';
foreach ($query->result_array() as $row)
{
$data[$row['id']] = $row['name'];
}
return $data;
Code:
<?php echo form_dropdown('is_active', $is_active_dropdown, set_value('is_active')); ?>