[eluser]umefarooq[/eluser]
what sort of error you are getting post here well i have one helper to create database driven dropdown here is code you have to get you values as id and name
Code:
$this->db->select(‘makeId as id’,‘makename as name’);
$this->db->from(‘lk_make’);
$this->db->where(‘status’,‘0’);
if(! function_exists('form_db_dropdown')){
function form_db_dropdown($data=''){
$rows = $data['rows'];
(array_key_exists('options',$data))?$options = $data['options']:$options = '';
if(count($rows) && !empty ($rows)) {
foreach($rows as $row){
$options[$row->id] = $row->name;
}
}
(array_key_exists('selected',$data))?$selected = $data['selected']:$selected = '';
(array_key_exists('extra',$data))?$extra = $data['extra']:$extra = '';
(array_key_exists('class',$data))?$extra = 'class= "'.$data['class'].'"':$extra = '';
return form_dropdown($data['name'],$options,$selected,$extra);
}
}
$rows = $query->result() ;
form_db_dropdown(array('name'=>'dd_name','rows'=>$rows))
try it, will work