TinyMCE Editor – Save Content in database using PHP & MySQL

TinyMCE is the most advanced WYSIWYG HTML editor designed to simplify website content creation. It has the ability to convert HTML textarea fields or other HTML elements to editor instances. TinyMCE is designed to easily integrate with JavaScript libraries.
In this tutorial, we will explain you how to use TinyMCE editor to replace textarea to save content in database using PHP and MySQL.
So let’s implement Save TinyMCE Editor Content with PHP & MySQL. look files structure:
  • use-tinymce-editor-with-php-mysql
    • assets
      • css
        • style.css
      • tinymce.min.js
      • custom.tinymce.js
    • templates
      • header.php
      • footer.php
    • class
      • DBConnection.php
      • Blog.php
    • index.php
Step 1: First, create MySQL Database Table named blog
Run the following script against MySQL to create the database blog table.
Step 2: Include jQuery and TinyMCE Editor Plugins
Step 3: Create HTML Form
Step 4: Initialize TinyMCE Editor
initialize TinyMCE editor. We will user textarea to convert into TinyMCE editor.
Step 5: Database configutation
Create a class file named DBConnection.php inside “class/” folder.
Step 6: Create a class blog
Create a class file named Blog.php inside “class/” folder.
Step 7: Create complete HTML file named index.php
Step 8: Create header (header.php)
This view contains the header section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header section.
Located at the top of a website, the header typically contains elements that include a company’s logo, website navigation, and contact information.
Step 9: Create a view file named footer.php
This view contains the footer section of the webpage.
  • jQuery – needed by Bootstrap JavaScript.
  • Bootstrap JavaScript – to make cool UI