Hi I want to make copy(duplicate) a record in same page and updated in database too using codeigniter from model.table id haulers.I get company(id) as dropdown of company name ,but not the other fields.Can u help me out to get solution.here is my code.
function copy_hauler($hauler_id)
{
$this->db->select('company,hauler_name,hauler_address_1,hauler_city,hauler_state,hauler_zipcode,hauler_phone,hauler_fax,hauler_email,hauler_website,hauler_contact_name,hauler_contact_number,request_email,request_text');
$this->db->from('haulers');
$this->db->where('hauler_id',$hauler_id);
$query= $this->db->get();
$following=array(
'company' =>set_value('company'),
'hauler_name' =>set_value('hauler_name'),
'hauler_address_1' =>set_value('hauler_address_1'),
'hauler_city' =>set_value('hauler_city'),
'hauler_state' =>set_value('hauler_state'),
'hauler_zipcode' =>set_value('hauler_zipcode'),
'hauler_phone' =>set_value('hauler_phone'),
'hauler_fax' =>set_value('hauler_fax'),
'hauler_email' =>set_value('hauler_email'),
'hauler_website' =>set_value('hauler_website'),
'hauler_contact_name' =>set_value('hauler_contact_name'),
'hauler_contact_number' =>set_value('hauler_contact_number'),
'request_email' =>$this->input->post('request_email'),
'request_text' =>$this->input->post('request_text'),
);
$this->db->insert('haulers',$following);
if ($this->db->affected_rows() == '1')
{
return TRUE;
}
return FALSE;
}