[eluser]Unknown[/eluser]
Hey, new with CI and I love it. However, I'm at the point in my site where I need a dynamic pulldown menu based on MYSQL results. I have a working script but I'd like for it to be done with form_dropdown()
What I need: Someway to get form_dropdown to read a MySQL table and display options based on the rows of that.
What I have:
Code:
$sql = "SELECT name, id from services";
$res = mysql_query($sql);
echo '<select name="service">';
echo '<option value="">--Select--</option>';
while($opt = mysql_fetch_array($res))
{
echo '<option value="'.$opt['id'].'">'.$opt['name'].'</option>';
}
echo '</select>';
echo "</select></form>";
That works fine but it WONT work with WITH my form_open() and my
$data = array(
'name' => 'added_reqs',
'id' => 'added_reqs',
'maxlength' => '100',
'style' => 'width:50%',
);
echo form_input($data);
style text_inputs.
Any help would be appreciated! Thanks.