[eluser]mdcode[/eluser]
I have a form with a few select boxes pulling options from the database. Basically when the for is loaded, I want these select boxes to be blank, however they are always populated with the result for id equal to 1. How can I get them to display blank without having blank rows in my db?
VIEW:
Seemingly the selected attribute on the form_dropdown() function in the view doesn't do anything... I have tried it with nothing:
Code:
<?php echo form_dropdown('customer', $customers, '', $dds); ?>
Blank:
Code:
<?php echo form_dropdown('customer', $customers, ' ', $dds); ?>
An id value:
Code:
<?php echo form_dropdown('customer', $customers, '2', $dds); ?>
And the result text:
Code:
<?php echo form_dropdown('customer', $customers, 'Customer One', $dds); ?>
CONTROLLER:
Code:
/* grab the customer list */
if ($customers = $this->projects_model->get_all_customers())
{
foreach ($customers as $key=>$value)
$data['customers'][$value['id']] = $value['name'];
}
MODEL:
Code:
/* get all customers */
function get_all_customers()
{
$this->db->select('*');
$this->db->from('customers');
$this->db->order_by('name', 'ASC');
$query = $this->db->get();
return ($query->num_rows) ? $query->result_array() : FALSE;
}
Any ideas peeps? Mucho appreciated.