开发者

Ckeditor, create php file to store in MySql

开发者 https://www.devze.com 2023-02-14 11:22 出处:网络
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 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_di开发者_开发百科v’).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
0

精彩评论

暂无评论...
验证码 换一张
取 消