Welcome Guest, Not a member yet? Register   Sign In
Fckeditor Form Validation
#9

[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:
&lt;textarea cols="70" rows="20" name="resume_body"&gt;&lt;?php echo $resume_info; ?&gt;&lt;/textarea&gt;

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


Messages In This Thread
Fckeditor Form Validation - by El Forum - 02-21-2009, 07:55 PM
Fckeditor Form Validation - by El Forum - 02-22-2009, 04:19 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:07 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:15 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:29 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:32 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:41 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 06:47 AM
Fckeditor Form Validation - by El Forum - 02-22-2009, 08:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB