Welcome Guest, Not a member yet? Register   Sign In
form_dropdown
#4

[eluser]defectivereject[/eluser]
With mine i use something like this

Code:
$data = array();
        $this->db->select('value, id');
        $this->db->order_by('value','asc');
        $Q = $this->db->get('table');
         if ($Q->num_rows() > 0){
           foreach ($Q->result_array() as $row){
             $data[$row['id']] = $row['value'];
           }
        }
        $Q->free_result();  
        return $data;
     }
this always gives me a dropdowns with the id as "value" and the value as the display
in the order i specified in the model query

then just use
Code:
echo form_dropdown('location', $options, 9, $data);
and it loads the dropdown with 9 as the displayed value........?


Messages In This Thread
form_dropdown - by El Forum - 07-05-2011, 05:48 AM
form_dropdown - by El Forum - 07-05-2011, 06:36 AM
form_dropdown - by El Forum - 07-05-2011, 06:44 AM
form_dropdown - by El Forum - 07-05-2011, 09:22 AM
form_dropdown - by El Forum - 07-06-2011, 12:06 AM
form_dropdown - by El Forum - 07-06-2011, 02:15 AM
form_dropdown - by El Forum - 07-06-2011, 05:41 AM
form_dropdown - by El Forum - 07-06-2011, 06:12 AM
form_dropdown - by El Forum - 07-06-2011, 06:55 AM
form_dropdown - by El Forum - 07-06-2011, 06:59 AM
form_dropdown - by El Forum - 07-06-2011, 07:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB