[eluser]TheFuzzy0ne[/eluser]
That's a subject that doesn't seem to be covered in much detail in the user guide. Here's what I've come up with.
Code:
<?php
echo form_open();
$options = array(
'Option 1',
'Option 2',
'Option 3',
'Option 4',
'Option 5',
);
$defaults = array(
1,
3,
);
echo form_multiselect('my_select[]', $options, (isset($_POST['my_select'])) ? $_POST['my_select'] : $defaults);
echo form_submit('submit', 'Submit');
echo form_close();
?>
I admit, it does seem a bit awkward, and the existing helper/documentation could definitely use some improvement.
To get an array of selected values:
Code:
$my_values = $this->input->post('my_select');