Reputation: 425
I have a TinyMCE editor that sends it's data to my database. The code that makes it work (so SQL doesn't throw a syntax error):
$artikel = htmlentities($_POST["artikel"]);
But now i'm trying to put it back into a TinyMCE editor to change the text. This kinda works but the formating isn't coppied over (see image). The code for this is:
echo'<script>$( window ).load(function(){tinymce.get("artikel").setContent("' . $row["Tekst"] . '");});</script>';
How can i make it so the text gets put in the editor with the formatting applied?
Upvotes: 0
Views: 937
Reputation: 455
You haven't got formatted text because HTML tags was escaped. For example
should be transformed to <p>. Please check what exactly are you getting in $row["Tekst"].
To reverse this behavior you can use
htmlspecialchars_decode()
Remember, this is unsafe for security!
Upvotes: 2