Welcome Guest, Not a member yet? Register   Sign In
form_dropdown and selected
#1

[eluser]nealumney[/eluser]
I have an array of items I want to include as a 'drop down' and so I have (within my view) the following code:

echo form_dropdown('manufacturer', $mftrs);

all is well and presents a list of manufacturers for the user to select from. However, I need the first item to be a 'Please select ... ' item, and have this as an entry in the $mftrs' array. What I want to do is to have this 'selected' rather than just appear in the list somewhere. I could of course manually do the following:
<select name="manufacturer">
<option value="">Please select ...</option>
&lt;?php
foreach ($mftr $key as $row)
{ ?&gt;
<option value="&lt;?php echo $key ;?&gt;" >&lt;?php echo $row ; ?&gt;</option>
&lt;?php } ?&gt;
</select>

Is there anyway of using the form_dropdown method with an array to choose the selected item?

Thanks,

Neal


Messages In This Thread
form_dropdown and selected - by El Forum - 04-20-2009, 12:45 PM
form_dropdown and selected - by El Forum - 04-20-2009, 12:56 PM
form_dropdown and selected - by El Forum - 04-20-2009, 01:01 PM
form_dropdown and selected - by El Forum - 04-20-2009, 06:45 PM
form_dropdown and selected - by El Forum - 04-20-2009, 11:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB