PHP editor

A PHP rich text editor that is just a form field.

No build step, no Composer package, no Node toolchain. Drop three tags on the page, mirror the editor into a hidden input, and $_POST gives you clean HTML. Image uploads post to a PHP endpoint you own, so files never leave your server.

PHP focus

Works the way PHP already works.

Plain form POSTA hidden input carries the HTML. No JSON API, no fetch wrapper, no framework required.
Your upload endpointrte_file_upload_handler posts to your PHP script; you decide where files land and what URL comes back.
Self-hosted, perpetualThe editor is static files served from your own host. No per-load metering and no phone-home.
Sony
Intel
Nokia
Siemens
IBM
Microsoft

Copy the editor folder, add three tags

The download ships a richtexteditor/folder of static assets. Copy it into your web root and reference it — there is nothing to compile and no dependency to install.

<link rel="stylesheet" href="/richtexteditor/rte_theme_default.css" />
<script src="/richtexteditor/rte.js"></script>
<script src="/richtexteditor/plugins/all_plugins.js"></script>

<div id="div_editor1" class="richtexteditor" style="width:min(960px,100%)"></div>

<script>
  var editor1 = new RichTextEditor(document.getElementById("div_editor1"));
</script>

Posting the HTML back with a normal form

The editor is a <div>, not an <input>, so mirror it into a hidden field on change. That keeps the whole thing inside the request/response model PHP already uses — no AJAX required unless you want it.

<form action="" method="post">
  <input name="htmlcode" id="inp_htmlcode" type="hidden" />

  <div id="div_editor1" class="richtexteditor"></div>

  <script>
    var editor1 = new RichTextEditor(document.getElementById("div_editor1"));

    // Mirror the editor into the hidden field so a normal POST carries the HTML.
    editor1.attachEvent("change", function () {
      document.getElementById("inp_htmlcode").value = editor1.getHTMLCode();
    });
  </script>

  <button>Submit</button>
</form>

Reading it on the server

What arrives is ordinary HTML. Treat it like any other user-submitted markup: store it, and sanitize it server-side before rendering it back to other users — the editor filters on input and output, but a server-side pass is the boundary that actually protects you. See why “nothing executes in the editor” is the wrong bar.

<?php
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
    $html = $_POST["htmlcode"];

    // Store it, or render it back. Nothing editor-specific happens here:
    // what you receive is ordinary, publish-ready HTML.
    echo $html;
}
?>

Image and file uploads

Set window.rte_file_upload_handler and the editor hands you each file. Post it to your own PHP script and return the stored URL. The bundled sample (rte-upload.php) shows GUID-based filenames and a progress dialog.

<script>
  // RichTextEditor calls this global whenever the user inserts a file.
  // Post it to your own PHP endpoint and hand back the stored URL.
  window.rte_file_upload_handler = function (file, callback) {
    var form = new FormData();
    form.append("fileforphp", file);

    var xhr = new XMLHttpRequest();
    xhr.open("POST", "/rte-upload.php");
    xhr.onload = function () { callback(xhr.responseText); };
    xhr.send(form);
  };
</script>

Making saved content look the way it did in the editor

One stylesheet ships specifically for rendering saved output, so published pages match what the author saw instead of inheriting whatever your theme does to tables and lists. It styles bare elements rather than a wrapper class, so link it on the pages that render editor content rather than site-wide.

<!-- Render saved content so it looks like it did in the editor.
     Note this stylesheet targets bare elements (body, table, p, div), so link it
     only on pages that render editor output, not on your whole site. -->
<link rel="stylesheet" href="/richtexteditor/runtime/richtexteditor_preview.css" />

<?php echo $html; ?>

Why PHP teams pick it

  • Nothing to install server-side: the editor is static JavaScript and CSS. It runs the same on shared hosting, a VPS, or a container, on any PHP version — because PHP never executes it.
  • Everything is included: AI Toolkit (bring your own key), tracked changes, comments, tables, and Word/PDF export ship in the base license — no premium add-on tiers.
  • Perpetual license from $129: one purchase, no subscription and no per-load metering — see pricing and the TinyMCE / CKEditor comparisons.

Using something else? There are matching guides for React, Vue, Angular, Svelte, Next.js, and Blazor, and plain JavaScript.