Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9114621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:14:28+00:00 2026-06-17T04:14:28+00:00

I have a rich text editor (tinyMCE specifically) in a textarea and I’m saving

  • 0

I have a rich text editor (tinyMCE specifically) in a textarea and I’m saving the HTML contents of that textarea into a PHP variable, as well as saving it in a hidden input field. I’m wondering how I can make this both secure and functional, especially with apostrophes or quotation marks that conflict with my hidden input.

I’ve tried using htmlspecialchars and htmlspecialchars_decode, but it’s not fully working as sometimes I’ll get random backslashes in the output (thus it’s not properly functioning.) However, this does seem to prevent issues with apostrophes or quotation marks conflicting with the HTML of the hidden input field.

Is there a perfect solution? I’m thinking about TryIt Editor, and how it can display html elements as well as apostrophes or quotation marks with no problems (as far as I know). How can I do something like that in my rich text editor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:14:29+00:00Added an answer on June 17, 2026 at 4:14 am

    I was on the right track thinking to use htmlspecialchars, I just needed to take it one step further and also use stripslashes. This removed the backslashes I were getting from htmlspecialchars.

    So something like:

    $content = htmlspecialchars($_POST["textarea"]);
    

    And then when I needed to output it, something like this:

    $htmlcode1 = "<html> \n <body>";
    $htmlcode2 = "</body> \n <html>";
    $somecontent = htmlspecialchars_decode(stripslashes($htmlcode1.$content.$htmlcode2));
    

    Hope this helps someone else out in the future!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with implementing Rich Text Editor (all that i tried, e.g. TinyMCE).
I have a website that allows to enter HTML through a TinyMCE rich editor
I have a rich text editor that passes HTML to the server. That HTML
I have a textarea with tinyMCE text editor to make it RichTextEditor. I want
I have a problem as follows: We're using a rich text editor (TinyMCE, but
We have an Ext JS app with a TinyMCE rich text editor handled by
I am making my Rich text editor. I have a textarea and an iframe.
I have looked at TinyMCE , FCKeditor , YUI Rich Text Editor , NicEdit
In my application I have a rich text-box.I use that as a text editor.
I have a an HTML form which contains the YAHOO rich text editor on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.