I have a form with a dropdown for categories.
it looks like this:
<tr>
<td><?= form_label('Categorieen'); ?></td>
<td><?= form_dropdown('categorieen', $opties); ?></td>
</tr>
for the $opties
i use this code:
$dbres = $this->db->get('categorieen');
$ddmenu = array();
foreach ($dbres->result_array() as $tablerow) {
$ddmenu[] = $tablerow['idcategorieen'];
}
$data['opties'] = $ddmenu;
But when i use this:
$this->input->post('categorieen');
it stores the value of the selected dropdown as an int.
so like this
select:
option1 (gives value 1, because of first option)
option2 (gives value 2, because it's the second option in de dropdown)
etc
How do i save the categoryid to the database instead of the number of the selected value?