×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
1
Language: PHP
Posted by: Ilmsg July
Added: Oct 3, 2012 6:51 AM
Views: 44
Tags: no tags
  1.         // model
  2.         public function dropdown_partial($table, $where_name, $where_data, $key_field, $value_field){
  3.                 $this->db->where($where_name, $where_data);
  4.                 $res = $this->db->get($table)->result();
  5.                
  6.                 $option = '';
  7.                 foreach( $res as $key => $item ){
  8.                         $option .= '<option value="'.$item->$key_field.'">' . $item->$value_field . '</option>';
  9.                 }
  10.                 return $option;
  11.         }