[eluser]digity[/eluser]
I'm trying to generate a drop down menu for a form with records from a table. The problem is I'm only getting the last record outputted to form_dropdown and not all of them.
The code:
Code:
...
// grab categories
if ($category_data['rows'] = $this->topic_model->getCategory()) {
$options = array();
foreach($category_data['rows'] as $r) {
$options = array($r->category_id => $r->category_name);
}
}
echo form_dropdown('category_id', $options);
...
The output:
Code:
...
<select name="category_id"><option value="1">Uncategorized</option></select>
...
What am I doing wrong? How do I fix this?
Thanks in advance