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 7076009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:14:47+00:00 2026-05-28T06:14:47+00:00

i have a TinyMCE implementation on my website that works great. But if the

  • 0

i have a TinyMCE implementation on my website that works great. But if the user enters a special char like “<” the query send to my MySQL database gets cropped just when the special char appears. Let me show you whats happining:

This is how i call TinyMCE:

tinyMCE.init({
        mode : "exact", elements : "e_text", theme : "simple", oninit : "setPlainText", plugins : "paste" });
        function setPlainText() {
            var ed = tinyMCE.get('e_text');
            ed.pasteAsPlainText = true;  
            if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
                ed.onKeyDown.add(function (ed, e) {
                if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
                    ed.pasteAsPlainText = true;
                });
            } else {            
                ed.onPaste.addToTop(function (ed, e) {
                ed.pasteAsPlainText = true;
            });
            }
        }

Dont worry about searching for an error there, that code renders the TinyMCE with no errors. Then i have a jquery function that holds the ajax process:

    $("#save-btn").click(function() {
            tinyMCE.triggerSave();
            alert($('#e_text').val());
            $("#status").html('<img src="css/img/ajax-loader.gif" align="absmiddle">&nbsp;Saving...');
            $.ajax({type: "POST",   url: "handler.php", data: "e_text="+ $('#e_text').val() + "&e_title="+ $('#extra_title').val(),
                        success: function(server_response){
                                $("#status").ajaxComplete(function(event, request){
                                alert(server_response);
                                        if(server_response.substring(0,4) == 'Last') {
                                            $("#status").html('<img src="css/img/available.png" align="absmiddle"> <font color="#06699e"> '+ server_response +' </font>&nbsp; ');
                                        }
                                        else {
                                            $("#status").html('<img src="css/img/not_available.png" align="absmiddle"> <font color="red">Not saved, please try again later. '+server_response+'</font>');
                                        }

                                });
                        }

                });
    });

This call handler.php wich handle the ajax call and then return a result. For this particular problem i modify the php script just to print the POST var and see what is going on, or in other hands, what is arriving to the php script:

} elseif(isset($_POST['e_text'])) { 
    $fgmembersite->DBLogin();
    echo($_POST['e_text']);
    mysql_query("INSERT INTO ".table_extra." (id,id_user,title,content) VALUES (NULL,'".$_SESSION['id_of_user']."','".mysql_real_escape_string($_POST['e_title'])."','".mysql_real_escape_string($_POST['e_text'])."') ON DUPLICATE KEY UPDATE title='".mysql_real_escape_string($_POST['e_title'])."', content='".mysql_real_escape_string($_POST['e_text'])."';");
    mysql_query("UPDATE ".$fgmembersite->tablename." SET last_update_cv = NOW();");
    $result = mysql_fetch_array(mysql_query("SELECT NOW();"));

    //echo 'Last saved ' . $result['NOW()'];
}

Ignore everything but the echo instruction. Returning to my jquery code you remember the two alert functions? Well one of them show me the data returned by the TinyMCE before sending it to the php script and the second one show the data returned data by the php script.

Lets suppose i insert the phrase “Hello world >>> Hello again!” into the TinyMCE, this is what i see:

enter image description here

Then i hit Save, and i got the alert number one:
enter image description here

I hit ok and i get the alert number two (the server response, what php got):
enter image description here

SO, WHY?!!! why is the php script (just and echo of what it gets via POST) is returning a cropped phrase? Just when the special char appear?

Thanks for any help you can offer me!

  • 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-05-28T06:14:48+00:00Added an answer on May 28, 2026 at 6:14 am

    Those ampersands are messing with the URL format for the data property.
    Why not change it to something like this instead?

    data: {
        "e_text": $('#e_text').val(),
        "e_title": $('#extra_title').val()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website which uses TinyMCE textboxes for editing. It works fine except
I have a great concern in deploying the TinyMCE editor on a website. Looking
I have a tinyMCE instance and I would like to know when the user
I have added tinyMCE to my django admin which works fine but now I
I have a website that allows to enter HTML through a TinyMCE rich editor
I have a page when user can add 0 to N TinyMCE editors that
I have a problem with tinyMCE but only on live environment from some reason
Is there a gem or plugin implementation of TinyMCE that is compatible with Rails
I have a TinyMCE widget that is limited to only <p> tags and non-block-level
I am building a small webapp for my website and have included tinyMCE as

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.