So I have a form with a textarea, the textarea is replaced with the wysiwyg editor, CKeditor
It works great and I can add the data to the database using htmlentities
and that works great, I can retrieve the data and display it with php, that works great...
But if I try to load it back into the CKeditor for editing purposes, the images are broken and the sources are replaced with backslashes
What do I need to do in order to prepare the content for ckeditor to use it and display it accuratly?
Any help is appreciated
Right now here is the code...
<textarea name="article" id="textarea">
<?php if (isset($record['article'])) { echo $record['article']; } ?>
</textarea>
and the javascript
$(document).ready(function() {
CKEDITOR.replace( 'textarea', {
toolbar: [
['Maximize'],
['Image','oembed'],
['Cut','Copy','Paste','PasteFromWord'],
['Undo','Redo','-','Find','Replace'],
['Link','Unlink'],
['Table','HorizontalRule','SpecialChar'],
['Bold','Italic','StrikeThrough'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['Format', 'FontSize', 'Subscript','Superscript', 'NumberedList','BulletedList','Outdent','Indent','Blockquote'],
['ShowBlocks', 'RemoveFormat', 'Source']
],
width: '99%',
height: 400,
defaultLanguage: 'en',
language: 'en'
});
});
Turns out with the help of Dagon's comment and a little exploration it was pretty simple, I removed the htmlentities when updating the database and replaced this code...
<textarea name="article" id="textarea">
<?php if (isset($record['article'])) { echo $record['article']; } ?>
</textarea>
With this...
<textarea name="article" id="textarea">
<?php if (isset($record['article'])) { echo stripslashes($record['article']); } ?>
</textarea>