CodeIgniter Forums
How to save index number of my dropdown list to database? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to save index number of my dropdown list to database? (/showthread.php?tid=46778)



How to save index number of my dropdown list to database? - El Forum - 11-15-2011

[eluser]tuckee[/eluser]
This is my drop down list

$type = array(
'1' => 'Entertaiment',
'2' => 'Formal',
'3' => 'Service',

);


echo form_dropdown('type', $type, '2');

I would like to know how do I save into my database as 1 or 2 or 3 (the index number of dropdown).


This is my code that input to database.

$type = $this -> input ->post('type');
$this->Advertisement_model->submit_ads($type);

I tried submit, and it seems it doesn't pass through any value in $type.

Please help me, urgent Sad

Thanks in advance