Welcome Guest, Not a member yet? Register   Sign In
Populate a Drop down from Database
#3

Controller is fine, but your model and view not.

Model:
PHP Code:
public function get_country_dropdownlist()
{
 
      $results $this->db->select('country_id, country_name'); 
 
                          ->get('country')
 
                          ->result_array();

 
      return array_column($results'country_name''country_id');


View:
PHP Code:
<?php echo form_dropdown('country_id'$country); ?>
Reply


Messages In This Thread
RE: Populate a Drop down from Database - by michalsn - 03-25-2016, 08:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB