CodeIgniter Forums
form_dropdown and set_value??? - 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: form_dropdown and set_value??? (/showthread.php?tid=27360)



form_dropdown and set_value??? - El Forum - 02-08-2010

[eluser]123wesweat[/eluser]
Hi,

1/ How do i select an already selected dropdown option???

2/ How do i combine set_value (form helper) with values read from a db??

3/ Set_value only works on input fields which are required, is this correct???

4/ Or should i not only use form_helper but use
Code:
<select name="myselect">
<option value="one" &lt;?php echo set_select('myselect', 'one', TRUE); ?&gt; >One</option>
<option value="two" &lt;?php echo set_select('myselect', 'two'); ?&gt; >Two</option>
<option value="three" &lt;?php echo set_select('myselect', 'three'); ?&gt; >Three</option>
</select>

while now i use
Code:
$options = array('one' => 'one', 'two'=>'two','three'=>'three');
&lt;?=form_dropdown('myselect', $options);?&gt;

regards,


form_dropdown and set_value??? - El Forum - 08-05-2010

[eluser]Cambo[/eluser]
Hi, i had the same problem.
Not sure if you found the answer to this, but it is here - http://ellislab.com/forums/viewreply/668894/