How to use Ckeditor in PHP?

Apr 05, 2022 . Admin

Hello dev,

I am going to explain you how to use ckeditor in php step by step. You will learn how to use ckeditor in php form.

This article will give you simple example of how to apply ckeditor in php. We will use get simple how to add ckeditor in php code.

I will give you simple Example of how to use ckeditor with php.

So, let's see bellow solution:

    $host = "localhost";
    $user = "root";
    $password = "";
    $dbname = "demos";
    $con = mysqli_connect($host, $user, $password,$dbname);

    if (!$con) {
        die("Connection failed: " . mysqli_connect_error());
<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>How to use Ckeditor in PHP? -</title>
    <link href="" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="" integrity="sha512-woYV6V3QV/oH8txWu19WqPPEtGu+dXM87N9YXP6ocsbCAH1Au9WDZ15cnk62n6/tVOmOo0rIYwx05raKdA4qyQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
        include "config.php";

            $title = $_POST['title'];
            $short_desc = $_POST['short_desc'];
            $long_desc = $_POST['long_desc'];

            if($title != ''){
                mysqli_query($con, "INSERT INTO contents(title,short_desc,long_desc) VALUES('".$title."','".$short_desc."','".$long_desc."') ");
                header('location: index.php');
    <div class="container mt-4">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header text-center bg-primary text-white">
                        <h4>How to use Ckeditor in PHP? -</h4>
                    <div class="card-body">
                        <form method='post' action=''>
                            <div class="mb-3">
                                <label for="Title"><strong>Title :</strong></label>
                                <input type="text" name="title" class="form-control">
                             <div class="mb-3">
                                <label for="Description"><strong>Short Description :</strong></label>
                                <textarea id='short_desc' name='short_desc' class="form-control"></textarea>
                             <div class="mb-3">
                                <label for="long_desc"><strong>Long Description :</strong></label>
                                <textarea id='long_desc' name='long_desc' ></textarea><br>
                             <div class="d-flex justify-content-center">
                                <input type="submit" name="submit" value="Submit" class="btn btn-success">
    <!-- Script -->
    <script type="text/javascript">
            height: "200px"

It will help you...