Dynamic TinyMCE WYSIWYG Editor with PHP, MySQL and AJAX

TinyMCE is a powerful and flexible rich text HTML WYSIWYG editor that can be embedded in web applications. It is a JavaScript library that helps you create HTML WYSIWYG editor.
In this tutorial, we will explain you how to load Dynamic content TinyMCE WYSIWYG Editor with PHP, MySQL and AJAX. This is a very simple example, you can just copy paste, and change according to your requirement.
Before started to implement the Dynamic TinyMCE WYSIWYG Editor with PHP, MySQL and AJAX, look files structure:
  • dynamic-tinymce-editor-with-php-ajax
    • assets
      • css
        • style.css
      • tinymce
        • tinymce.min.js
        • custom.tinymce.js
    • templates
      • header.php
      • footer.php
    • index.php
    • action.php
Step 1: Create the database and Table
For this tutorial, you need a MySQL database with the following table:
Step 2: Include the TinyMCE script
Step 3: Initialize TinyMCE as part of a web form
Initialize TinyMCE on any element (or elements) on the web page by passing an object containing a selector value to tinymce.init(). The selector value can be any valid CSS selector.
For example: To replace ‹textarea id=”event-content”› ‹/textarea› with a TinyMCE editor instance, pass the selector '#event-content' to tinymce.init().
Step 4: Database Connection class
Create a class file named DBConnection.php inside “class/” folder.
Step 5: Create a class file
Create a class file named Event.php inside “class/” folder.
  • The Event class handles the CRUD process.
  • __construct() – Loads the required class.
  • create() – Insert recored in database
  • update() – Update record in database
  • getList() – Get record from database
  • delete() – Delete record from database
Step 6: Create action file named action.php
Step 7: complete HTML web form
Create files named (header.php and footer.php)
This file contains the header and footer section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
footer.php