CKEditor PHP Tutorial | How to Insert CKEditor Text MySQL Databse using PHP ( PART 2 )




CKEditor PHP Tutorial | How to Insert CKEditor Text MySQL Databse using PHP ( PART 12)

Original source


19 responses to “CKEditor PHP Tutorial | How to Insert CKEditor Text MySQL Databse using PHP ( PART 2 )”

  1. 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);
    ?>

  2. 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

Leave a Reply