• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dropdown List from MySQL to HMTL <select>

#1
[eluser]cPage[/eluser]
//-- MODEL
Code:
function select_list($string)
{
  $q = $this->db->query('SELECT '.$string.' FROM '.$this->table);
  return $q->result_array();
}
//-- CONTROLLER
Code:
$data['myListClient'] = $this->client_model->select_list('id_client,client');
//-- VIEW
Code:
foreach( $myListClient as $row )
{
   $dd[$row['id_client']] = $row['client'];
}
echo form_dropdown('lstClient', $dd);

#2
[eluser]jprateragg[/eluser]
Did you have a question???

#3
[eluser]cPage[/eluser]
How can i have 2 columns per row inside the dropdown control ? I mean on the same level .

#4
[eluser]CroNiX[/eluser]
You'd have to use CSS, and the form_dropdown() function doesn't allow you to customize the output, so you'd have to do it manually.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.