Bootstrap FreeKB - CKEditor - Parse content through PHP htmlspecialchars
CKEditor - Parse content through PHP htmlspecialchars

Updated:   |  CKEditor articles

CKEditor will change the opening bracket character < to the markup &lt; and closing bracket character > to &gt;.  For example, if <input type="text"> is placed inside of a CKEditor code snippet, &lt;input type="text"&gt; will br produced. This will cause problems with CKEditor and the web page.

 As an example, let's say you are using PHP to retrieve data from a column named content in a SQL database.

<?php
   $content = $row["content"];
?>

 

The PHP htmlspecialchars function can be used to fix the problem where CKEditor changes certain special characters to HTML. 

<?php
   $content = htmlspecialchars($row["content"], ENT_QUOTES);
?>

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter ed5dfc in the box below so that we can be sure you are a human.