<?php
$options = array();
$options[0] = "Kies het kampioenschap";
foreach ($kampioenschappen as $kampioenschap) {
$options[$kampioenschap->kampioenschapsId] = $kampioenschap->naam;
}
$js = 'id="kampioenschap" style="width: 600px';
echo form_dropdown('kampioenschap', $options, '0', $js) . "
";
?>
I want to create a dropdown form so the user can select a championship that he wants to view.
This all works but I have a problem with showing the first value in the $options array. In the CodeIgniter docs they say:
echo form_dropdown('name', $options, 'selectedvalue', $js);
If I look at the source output in my browser, this is what I see:
<select name="kampioenschap" id="kampioenschap" style="width: 600px>
<option value="0" selected="selected">Kies het kampioenschap</option>
<option value="2">Nationaal kampioenschap</option>
<option value="3">Waals kampioenschap</option>
<option value="5">Vlaams kampioenschap</option>
</select>
For me this looks like valid xhtml code. But when I open the page with Firebug or DragonFly, I get this:
<select id="kampioenschap"
selected="selected" 0"="" style="width: 600px>
This makes no sense to me, I have other dropdown in my application that work just fine.
Can someone point out the mistake I made?