You need AJAX magic. Through JavaScript inside the page, you get edited HTML. Then you send it to the server where the PHP script receives it and can transfer it to MySQL.
Here is a simple test case that will show you the ropes.
Start with editable HTML.
<div id='textToBeSaved' contenteditable='true'> <p>Using the <strong>Terminal</strong> in OS X makes you all-powerful.</p> </div>
We also need a Save button that will be used to trigger the POST event.
<button onclick='ClickToSave()'>Save</button>
Such a button could well position itself on the CKEditor toolbar, but this will require more coding, and I will leave it to someone who is better at JavaScript than me.
Of course you want to enable CKEditor. For my sample code, I will also use jQuery, which I will use for AJAXing results.
<script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script> <script type='text/javascript' src='CKEditor4/ckeditor.js'></script>
Now the script that will be executed when the "Save" button is clicked. It will use CKeditor to capture the edited HTML, then jQuery to send it.
<script type='text/javascript' language='javascript'> // <![CDATA[ function ClickToSave () { var data = CKEDITOR.instances.textToBeSaved.getData(); $.post('save.php', { content : data }) } // ]]>
Here it is, you donβt need anything else for customers.
On the server, you must have PHP code that will act when the POST script updates the HTML. The script should be called save.php and located in the same directory as the HTML, if you use my code verbatim. My single line font here just saves your HTML in a temporary file inside the / tmp folder. Feel free to add your MySQL magic instead.
<?php file_put_contents('/tmp/serverside.html', $_POST['content']); ?>