Devidas Kadam
Devidas Kadam

Reputation: 944

summernote text not storing into database

I am using summernote for editing the text , when I give the style to text by summernote toolbar or menu, it appears, but after submitting the text and html tags are stored in database, the style escaping by this.

<div id="summernote"><?php echo stripslashes($career['description']); ?></div>
                    <textarea class="form-control" id="deschere" name="desc" placeholder="Description" rows="20" style="display: none;"></textarea>

script

<script type="text/javascript">
$('#thisform').submit(function(e){
    $('#deschere').html($('#summernote').code());
    console.log($('#deschere').html());
    //e.preventDefault();
});

code to store in database

$data['title']= $this->input->post('title');
$data['description']= $this->input->post('desc');
$data['date']=date('Y/m/d h:i');
$id=$this->input->post('id');
$this->db->where('id',$id);
$response=$this->db->update('careers',$data);
return $response;

anyone have solution for this ? thank you.

Upvotes: 0

Views: 3385

Answers (2)

Yod
Yod

Reputation: 46

1.Check XSS Filtering in application/config/config.php $config['global_xss_filtering'] = TRUE; set to FALSE; because it will remove inline style from summernote.

  1. $this->input->post('desc', FALSE); set to FALSE

Upvotes: 3

trzyeM-
trzyeM-

Reputation: 953

Perhaps when you insert data into the database , the tags are automatically removed?

Upvotes: 0

Related Questions