[eluser]Gary Buckle[/eluser]
I'm brand new to CI.
I seem to be unable to return the right result from the form_dropdown function.
form_input works fine but the form_dropdown doesn't.
My code
Controller addCustomer();
$data['CustomerName'] = array('name' => 'CustomerName', 'id' => 'CustomerName','maxlength' => '100',
'size' => '50',
'style' => 'width:100%');
The $data is passed (as yet) to the view.
Controller customerFormSubmit()
I get the post data
$CustomerName = $this->input->post('CustomerName');
VIEW create a dropdown from possible names.
$contactArray = array();
$this->db->select('contact_id,ContactName');
$query = $this->db->query('SELECT CustomerName FROM customers');
$query = $this->db->get('contacts');
if ($query->num_rows() > 0)
{
foreach ($query->result()as $row)
{
$contactArray[$row->contact_id] = $row->ContactName;
}
}
echo form_dropdown('CustomerContact',$contactArray,'1');
The form_dropdown seems returns the id of the CustomerContact NOT the actual name.
If I use echo $CustomerName; to print out the postdata.
Any ideas ?