[eluser]macleodjb[/eluser]
I switched to a text area and discovered that it is in fact updating the resume in the database with the exception of the actual resume. It is modifying the date_modified field but not the resume_text field. I switched to $_POST instead of using codeigniter and it does the same thing.
here's my function.
Code:
function update_resume($id) {
$resume_post = $_POST['resume_body'];
$resumetxt = htmlspecialchars(strip_tags(trim($resume_post),'<strong><i><br><br />'));
$update_resume = $this->db->query("UPDATE `user_resume` SET "
. "`resume_text` = '".$resumetxt."', "
. "`date_modified` = NOW() WHERE (`user_id` = '$id')");
$r_updated = $this->db->affected_rows($update_resume);
if($r_updated > 0) {
return true;
} else {
return false;
}
}
and this is my current html
Code:
<textarea cols="70" rows="20" name="resume_body"><?php echo $resume_info; ?></textarea>
and this is in my controller.
Code:
function resume() {
if(!isset($_SESSION['uid'])){
$this->session->set_flashdata('message','You must be logged in to edit your resume');
redirect('login/login');
}
if($_SESSION['user_type'] == '1'){
$this->session->set_flashdata('message','We\'re Sorry you do not have access to this section');
redirect('home');
}
$this->load->model('Edit_model');
$this->load->model('Main_model');
$this->load->library('form_validation');
$user_id = $_SESSION['uid'];
$resume_info = $this->Main_model->get_resume($user_id);
if($this->input->post('resume')){
$resume_value = $this->input->post('resume_body');
} else {
$resume_value = $resume_info['resume_text'];
}
$this->load->library('fckeditor',array('instanceName' => 'resume_body'));
$this->fckeditor->BasePath = base_url().'system/plugins/fckeditor/';
$this->fckeditor->ToolbarSet = 'Basic';
$this->fckeditor->Height = 400;
$this->fckeditor->Width = 700;
$this->fckeditor->Value = $resume_info['resume_text'];//$resume_value;
$data['resume_box'] = $this->fckeditor->CreateHtml();
$this->form_validation->set_rules('resume_body', 'resume_body', 'htmlspecialchars|trim|required');
$data['resume_info'] = $resume_info['resume_text'];
$data['page_title'] = "";
$data['page_desc'] = "";
$data['page_keywords'] = "";
$data['industry'] = $this->Main_model->get_industry();
if ($this->form_validation->run() == FALSE){
$this->load->view('edit/edit_resume', $data);
} else {
$resume = $this->input->post('resume_body');
if(empty($resume)){
echo "Resume was empty";
} else {
if($this->Edit_model->update_resume($_SESSION['uid'])){
$this->session->set_flashdata('message','Your resume was sucessfully updated!');
redirect('dashboard');
} else {
$this->session->set_flashdata('message','There was an internal error, please contact support');
redirect('dashboard');
}
}
}
}// end of function