Question

I am new in using ckeditor. I have installed ckeditor. In the editor, showed in my HTML page, i can write article there. But i don't know how to save it and show the article in my HTML page. here is my html code:

<form method="post">
<p>Editor:

<textarea class='ckeditor' id="ckeditor" name="ckeditor" row="10" cols="80">
</textarea>

<script type="/text/javascript">
            CKEDITOR.replace('ckeditor');
</script>
    </p>
    <p>
    <input type="submit">
    </p>
</form>

No correct solution

OTHER TIPS

You need to have a back-end of some sort. CKEditor works in the browser, so what you need to do is take that data, post it to your server and save it there. Your next step is to find out how what server side languages can you use - such as PHP. You need to learn how to build a system on your server that receives the data. There are various ways of doing this and they depend a lot on what kind of server you have.

Learn how to build a system with your server side language that receives POST and GET requests and saves them into a Database or a File. I recommend a Database, but that takes a little more learning I'm afraid.

You can get the data from CKEditor using JavaScript. Inside your form you need to add a small bit of JavaScript to update your textarea with the value of the editor. This is because CKEditor works by replacing the textarea with an iframe element - and thus the changes made in the iframe are not automatically applied to the textarea. You will need to learn how to attach a click event handler to your submit button and before submitting you need to run the following code that I copied from this other StackOverflow question.

for(var instanceName in CKEDITOR.instances) {
    CKEDITOR.instances[instanceName].updateElement();
}

Good luck, have fun!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top