srinivasankanna
srinivasankanna

Reputation: 1323

Ckeditor not Storing as i formatted into mysql

I'm using ckeditor basic version 4.3. When i am storing data in MySQL the formatted data doesn't get stored. For example when I use bullet points or numberings it's not getting stored as I format. How to resolve this problem?

This is the code I used to integrate and store.

<script src="ckeditor1/ckeditor/ckeditor.js"></script>

   <textarea name="editor1" id="editor1" rows="10" cols="10"></textarea> 

   <script>
     CKEDITOR.replace( 'editor1' );
   </script>

<?php
    $abt_description =$_POST['editor1'];    
    $insert_news = mysql_query("insert into table (colum) values ('$abt_description');
?>

Upvotes: 1

Views: 1373

Answers (3)

Raj Mohan
Raj Mohan

Reputation: 543

Try this

 $insert_news = mysql_query("insert into table (colum) values ('".$abt_description."');

Upvotes: 1

oleq
oleq

Reputation: 15895

You need the HTML Writer Plugin to have a pretty, formatted output in CKEditor. It's not available in basic build to save bytes and keep things as simple as possible. Use the on-line builder, select Basic preset and add Html Output Writer plugin manually to your package.

Of course, you can just download standard/full package which contains HTML Writer Plugin by default.

Upvotes: 0

BlueDeath
BlueDeath

Reputation: 134

As the commenter says, stripslashes() solves the problem. Add before the insert:

$abt_description = stripslashes($abt_description);

Note: I recommend using mysql_real_escape_string() on your input.

Upvotes: 2

Related Questions