简体   繁体   中英

Ckeditor, create php file to store in MySql

I'm using CKeditor but I'm not working out how to create the php file that stores editing textareas in MySql DB. I'm quite newbie in php/mysql.. javascript code of CKeditor calls is:

$(’#my_div’).ckeip({
e_url: ’test.php’,
data: {
example_var : ’example_value’,
example_var2 : ’example_value2’
}
)};

What I have to write in test.php to making it store data of ckeditor in MySql? Should I create a new table in database first ?

thanks a lot

I think the best way to handle this is create a new MYSQL table with two columns. One as an id for the textarea and then the other column to store the text. For a basic tutorial about MYSQL and PHP check out W3School http://www.w3schools.com/PHP/php_mysql_intro.asp

I am a newbie to CKEditor, too. But it seems like it would be quite easy once you get the data from the editor into a javascript variable, like:

var editorData = $('my_div').ckeditorGet().getData();

You can then put editorData into a hidden input field and then submit it to the PHP file that you're going to create. On that PHP file you would take it with something like:

$theData = $_GET["name_of_the_hidden_input_field"];
//here comes the PHP code for inserting $theData into mysql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM