[eluser]developer10[/eluser]
Since i want to use CI's alternative PHP syntax all the way long,
i'm faced with this issue while trying to rebuild my search form
this is what i found in CI's manual on this:
Code:
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, 'large');
// Would produce:
<select name="shirts">
<option value="small">Small Shirt</option>
<option value="med">Medium Shirt</option>
<option value="large" selected="selected">Large Shirt</option>
<option value="xlarge">Extra Large Shirt</option>
</select>
echo form_dropdown('shirts', $options, $shirts_on_sale);
// Would produce:
<select name="shirts" multiple="multiple">
<option value="small" selected="selected">Small Shirt</option>
<option value="med">Medium Shirt</option>
<option value="large" selected="selected">Large Shirt</option>
<option value="xlarge">Extra Large Shirt</option>
</select>
since $option should come from database, i dont know how to turn the array of results
from my existing model (the same model is used for pulling categories for left column),
which retrieves the very same rows (categories) i want to use in form_dropdown()
so, here's the end of my model function:
Code:
if ($query->num_rows() > 0) {
return $query->result();
} else {
return FALSE;
}
so how can i throw that result into $option variable needed by form_dropdown()?
i tried using foreach loop to generate array elements (some of you are probably LOL
right now) but hey, i'm pretty new to CI.
thans for any suggestions