CodeIgniter Forums
[SOLVED] form_dropdown() does multipart on its own? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [SOLVED] form_dropdown() does multipart on its own? (/showthread.php?tid=38080)



[SOLVED] form_dropdown() does multipart on its own? - El Forum - 01-30-2011

[eluser]ipsod[/eluser]
I'm using CI 2.0 and have this code:
Code:
echo form_dropdown('to', $accounts, $to);

For no apparent reason, this is the output
Code:
<select name="to" multiple="multiple">
<option value="2" selected="selected">Westair</option>
<option value="3">Ebay</option>
<option value="4">R&J Rentals</option>
</select>

. . . multiple="multiple"???


[SOLVED] form_dropdown() does multipart on its own? - El Forum - 01-30-2011

[eluser]Cristian Gilè[/eluser]
$to is an array of multiple items

Code:
count($to) > 1


form_dropdown() accepts four parameters:.
Quote:The first parameter will contain the name of the field, the second parameter will contain an associative array of options, and the third parameter will contain the value you wish to be selected. If you would like the opening <select> to contain additional data, like an id attribute or JavaScript, you can pass it as a string in the fourth parameter


Cristian Gilè


[SOLVED] form_dropdown() does multipart on its own? - El Forum - 01-30-2011

[eluser]ipsod[/eluser]
Thank you, Cristian. I was handing it an array.