[eluser]Iverson[/eluser]
I got tired of recreating a dropdown so I made a view that I can just include in my application. You can use the following variables:
Code:
<?php
// Optional variables
$config['name'] = 'element_name'; // sets the name attribute to "element_name"
$config['id'] = 'element_id'; // if not specified, the element will have the same name and id
$config['class'] = 'fancy_select'; // set the class attribute to 'fancy_select'
$config['multiple'] = TRUE; // makes the menu a multiple select type
$config['selected']['XX'] = ' selected="selected"'; // sets "XX" to be selected
$config['selected']['XY'] = ' selected="selected"'; // sets "XY" to be selected. Also, the menu becomes a multiple select. No need to use $config['multiple']
$config['size'] = 25; // Sets the multiple select menu size
echo $this->load->view('state_dropdown', $config, TRUE);
This can easily be ported into a plugin or helper but I just didn't feel like it at the current moment