Welcome Guest, Not a member yet? Register   Sign In
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.




Theme © iAndrew 2016 - Forum software by © MyBB