I am using summernote as my WYSIWYG editor. So I have submitted its contents through ajax using formdata. I've done the following:
formdata.append('content', $('.summernote').code());
So my PHP accepted it and save into my database. However, all css properties were gone upon saving like font style and font sizes etc. I am using CodeIgniter in my php and this is my code in saving:
public function save_spot_report($data){
$to_return = true;
$this->db->trans_begin();
$this->save_spot_report_details($data);
if($this->db->trans_status() === FALSE){
$this->db->trans_rollback();
$array['error_message'] = $this->db->_error_message();
$array['error_number'] = $this->db->_error_number();
$to_return = $array;
}else{
$this->db->trans_commit();
}
return $to_return;
}
public function save_spot_report_details($data){
$this->load->library('DateTimeHelper');
$data['created_by'] = $this->session->userdata('username');
$data['date'] = $this->datetimehelper->get_current_date();
$config['table'] = 'spot_report_tbl';
$config['data'] = $data;
$this->special_save($config);
}
public function special_save($config){
if(!isset($config['type'])){
$config['type'] = "INSERT";
}
if(strtolower($config['type']) === "insert"){
$this->db->insert($config['table'],$config['data']);
}else{
$this->db->where($config['conditions']);
if(!isset($config['use_set'])){
$this->db->update($config['table'], $config['data']);
}else{
$params = $config['set_params'];
$this->db->set($params['param_1'], $params['param_2'], $params['param_3']);
$this->db->update($config['table']);
}
}
return $this->check();
}
Your responses will be greatly appreciated! Thanks!