How to submit text from CkEditor to database


#1

Hello

can anyone let me know how can i install ckeditor and submit content to blog post

currently i have done some work and install the ckeditor but not able to find out how to submit the content in db and show in page like blog posts

i have added the following code

<script src="../admin/editor/ckeditor.js"></script>
 <script type="text/javascript" src="../admin/editor/ckeditor.js"></script>


			 <form method="post">
		<p>
			
			<textarea id="editor1" name="editor1"> </textarea>
			<script type="text/javascript">
				CKEDITOR.replace( 'editor1' );
			</script>
		</p>
		<p>
			<input type="submit" />
		</p>
	</form>

please let me know what should i do further to submit the content

thanks


#2

First you have to choose a DBMS like Postgres, MySQL or SQLite. Just lookup some comparison sites. Then you have to install it, for Postgres and MySQL as a seperate service, for SQLite you have to compile PHP with the module. Then within your PHP script you can connect to your DBMS via PDO. Have a research for basic PDO usage and find out how to use SQL. After that you can start handling data from form requests.


#3

working example


#5

sorry for the late reply due to some issue was not able to reply please let me know how should i connect editor with my panel

thanks


#6

without knowing what you already have in place it is going to be pretty hard for anyone to help. Do you have a database? what type is it? Do you have custom scripts to add blog posts or are you using something like wordpress?

CKeditor basically just converts text you write into a text area into html so what you do with that is then up to you. You just submit it like a normal form variable so if you have a form already that upload plain text into a blog post just apply the ckeditor script to the input fields you want to be html.

If you don’t yet have a database setup and don’t know how to insert data then it is going to be a fair bit of work getting up to speed as you will not only have to know how to insert it but you’ll need to know how to get it back and all the security issues that surround it. It’s obviously not impossible but knowing where you are at at the moment would be a good start.


#7

yes i have mysql


#8

Why are you loading the ckeditor.js file twice?

There’s a help page on the CKEditor website that explains how to retrieve and save the data:


#9

i have the ck editor in the page but need to know how to submit the content to db within its category for that i need hellp

This is the editor img

mostly have done what is there in the https://ckeditor.com/docs/ckeditor4/latest/guide/dev_savedata.html


#10

which steps have you done? what was the result?


#11

i have put the code above nothing more is done yet


#12

You need to grab the data entered into the POST field once the form has been submitted and enter that data into your database.

If you’re not sure how to do that, then you should probably watch/read a few online tutorials about PHP and MySQL, there are lots here on this very website.