Hi, I had problem with auto writing to database after load or refresh ckeditor page so i had to find out how to check if textarea is empty and stop it writing blank data to database. so here is code : <?php include '../databaseconnect.php'; ?> <?php // CHECK EMPTY TEXTAREA if (!strlen(trim($_POST['editor']))) { echo "EMPTY"; // KILL IF TEXTAREA IS EMPTY die; } else { //WRITE
if (isset($_POST['editor'])) { $cont = $_POST['editor']; echo "$cont"; } } //WRITE TO DB $query = mysqli_query($msconn, "INSERT INTO data (cont) VALUES ('$cont')"); if ($query) { echo "WRITE DB OK"; } else { echo "WRITE DB ERROR"; } mysqli_close($msconn); ?>
19 responses to “CKEditor PHP Tutorial | How to Insert CKEditor Text MySQL Databse using PHP ( PART 2 )”
Both of your two videos were essential… Thanks… Shouldn't it be, if(isset($_Post('submit'))) ?
Hi, I had problem with auto writing to database after load or refresh ckeditor page so i had to find out how to check if textarea is empty and stop it writing blank data to database. so here is code :
<?php
include '../databaseconnect.php';
?>
<?php
// CHECK EMPTY TEXTAREA
if (!strlen(trim($_POST['editor'])))
{
echo "EMPTY";
// KILL IF TEXTAREA IS EMPTY
die;
}
else
{
//WRITE
if (isset($_POST['editor']))
{
$cont = $_POST['editor'];
echo "$cont";
}
}
//WRITE TO DB
$query = mysqli_query($msconn, "INSERT INTO data (cont) VALUES ('$cont')");
if ($query)
{
echo "WRITE DB OK";
}
else
{
echo "WRITE DB ERROR";
}
mysqli_close($msconn);
?>
You can send me your project with database please ?
how can i select and view the content?
10Q
im looking explentation for ckeditor and finally i have find it in your video – great job! greetings from Poland
i could not get the value of textare using this $('#editor1').val(). how can i get the value of textarea in javscript?, please realy need help. thanks
I love you man
I very thank you. This film very help me.
i have been facing problem in view page. html tag show in view page. can you help me about this?
like shows in view page —–
<p><strong>dsfh</strong> <s>gdhdjh</s>
<u>gsdghshs</u><span style="font-size:48px">
fasfaga</span><u> afadag </u><span
style="font-size:24px"><span style="font-family:Comic Sans
MS,cursive">afdagadg</span></span></p>
thnx
I've tried this … but nothing goes … i did everything you've done but it doesn't send any thing to DB
it just refresh the page :/
why did you check if(isset($_POST['editor'])) ?
I Totally like the video 😀
here is one subscribe and a thump Up (y) (y)
I inserted to database, how can i edit in ckeditor, please help me.
how you embed the editor on text area using only class ? please explain
Hi, I have written code same you, but not insert to database , but echo "$ text"; After hitting submit, please help me.
Perfect.. Thumbs Up…
Hello, you just earned a subscriber and a like. Very clear tutorial! Thanks!
what if user inputs image? do i still use content as type of varchar?