My goal is to update job_contract. There are two ways that this SHOULD be done. 1. through the client's page AND 2. through the provider's page.
What I currently have is in my job model is:
public function update_job_contract($post_obj)
{
$id = $post_obj['id'];
$data = array
(
'client_feedback' => $post_obj['client_feedback'],
'client_notetoself' => $post_obj['client_notetoself'],
'contract_status' => $post_obj['contract_status'],
'client_id' => $this->auth_model->get_user_id()
);
$this->db->insert('job', $data);
}
public function provider_update_job_contract($post_obj)
{
$id = $post_obj['id'];
$data = array
(
'provider_feedback' => $post_obj['provider_feedback'],
'provider_notetoself' => $post_obj['provider_notetoself'],
'provider_id' => $this->auth_model->get_user_id()
);
$this->db->insert('job', $data);
}
I have the following lines in my client controller page:
public function update_job_contract()
{
$this->validateRole('client');
$this->load->model('job_model');
$id = $this->uri->segment(3,0);
$data['job'] = $this->job_model->get_job($id);
$this->load->view('client/update_job_contract', $data);
}
public function update_job_contract_submit()
{
$this->validateRole('client');
$this->load->model('job_model');
if ( '0' == $_POST['id'] ) {
$this->job_model->update_job_contract($_POST);
//}
redirect('client/manage_job_contracts?message=Congratulations!');
}
And this in my provider controller page:
public function provider_update_job_contract()
{
$this->validateRole('provider');
$this->load->model('job_model');
$id = $this->uri->segment(3,0);
$data['job'] = $this->job_model->get_job($id);
$this->load->view('provider/provider_update_job_contract', $data);
}
public function provider_update_job_contract_submit()
{
$this->validateRole('provider');
$this->load->model('job_model');
if ( '0' == $_POST['id'] ) {
$this->job_model->provider_update_job_contract($_POST);
}
redirect('provider/job_contracts?message=Congratulations!');
}
Problem is, they don't really update the entries. Please help..