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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:24:46+00:00 2026-06-10T17:24:46+00:00

This problem seems very strange to me because it is intermittant. I am going

  • 0

This problem seems very strange to me because it is intermittant. I am going to be detailed so please bear with me.

I have a textarea which is made into a wysiwyg editor with http://redactorjs.com

I am using the click-to-edit feature (http://redactorjs.com/docs/examples/click-to-edit/) and saving the data with an ajax post.

The mysql database field is called ‘Info’ and is set to type ‘blob’.

Now, if i enter the following text into the textarea and press save, it will probably store it fine.

“Hello my name is greg and i am a very good actor.
I am also a cooking enthusiast who once came 2nd in a cooking competition.”

Then if i click edit and add to it

“Hello my name is greg and i am a very good actor.
I am also a cooking enthusiast who once came 2nd in a cooking competition. I also like to swim on a thursday morning!”

I sometimes see that only something like the below will be saved into the db.

“Hello my name is greg and i am a very good actor.
I am also a cooking enthusiast who once came”

Then if if edit it again and add the same text back in and save again it saves successfully!?!?

Let me show you some code..

view.php

echo the info data

<script>
function ClickToEditInfo()
{ 
    var info =  ['formatting', '|', 'bold', 'italic', 'deleted', '|',
                    'unorderedlist', 'orderedlist', 'outdent', 'indent', '|',
                    'table', 'link', '|',
                    'fontcolor', 'backcolor', '|', 
                    'alignleft', 'aligncenter', 'alignright', 'justify', '|',
                    'horizontalrule']
    $('#info').redactor({ 
            focus: true,
            buttons: info,
            wym: true,
            fixed: true
    }); 
}

function ClickToSaveInfo()
{
    var html = $('#info').getCode();
    var item = <?php echo $item_id; ?>;

    $.ajax({
            type: 'POST',
            url: "ajax/clickToEditInfo.php",
            data: "item_id="+item+"&html="+html,
            error: function(xhr, status, error) {
                console.log(error);
            },
            beforeSend: function() {
                $("#ajax").show();
                $("#ajax").html('<span class="label label-info">Saving info.. please wait</span>');
            },
            success: function(html){
                console.log(html);
                $("#ajax").html('<span class="label label-success">Saved!</span>');
                $("#ajax").fadeOut(1000, function () {
                    $(this).hide();
                });
            }
    });

    $('#info').destroyEditor(); 
}
<?php 
    endif; // end check if user owns item
}
?>
</script>

        <div id="info">
            <?php echo $item->getMainField('info', $item_id); ?>
        </div>  

clickToEditInfo.php

<?php 
include_once('../classes/item.class.php');
if (!isset($_SESSION)) session_start();

$item_id = $_POST["item_id"];
$html = $_POST["html"];
$user_id = $_SESSION['jigowatt']['user_id'];

if( $item->checkUserOwns($user_id, $item_id) ) : //check user owns item

    $item->clickToEditInfo($user_id, $item_id, $html);

else : // user does not own it
    return false;
endif; // end check if user owns item
?>

and

item.class.php > clickToEditInfo

public function clickToEditInfo($user_id, $item_id, $html) {
    $stmt = parent::query("UPDATE `item_main` SET `info` = '$html' WHERE `item_id` = $item_id AND `user_id` = $user_id");
}

Can you think of a reason why the data posted in the DB gets intermittently truncated?

UPDATE:

I have found a way to reliably reproduce it.
like i said its a wysiwyg editor.

“Hello my name is greg and i am a very good actor. I am also a cooking enthusiast who once came 2nd in a cooking competition.”

if i highlight competition and click the hyperlink button and link it to google for example. Press Save and the following is inserted.

“Hello my name is greg and i am a very good actor. I am also a cooking enthusiast who once came 2nd in a cooking”

i have edited

<?php 
include_once('../classes/item.class.php');
if (!isset($_SESSION)) session_start();

$item_id = $_POST["item_id"];
$html = $_POST["html"];
$user_id = $_SESSION['jigowatt']['user_id'];

if( $item->checkUserOwns($user_id, $item_id) ) : //check user owns item

    $item->clickToEditInfo($user_id, $item_id, $html);

    **echo $html;**

else : // user does not own it
    return false;
endif; // end check if user owns item
?>

and the console.log(html) is showing

<p>Hello my name is greg and i am a very good actor. I am also a cooking enthusiast who once came 2nd in a cooking

so its not posting all the data, something to do with the html tags?

UPDATE2

I have done console log on var html = $(‘#info’).getCode();
and confirmed that

<p>Hello my name is greg and i am a very good actor.</p><p>I am also a cooking enthusiast who once came 2nd place on Come dine with me :)&nbsp;<a href="goggle" target="">link</a>&nbsp;</p>

is posted, yet only

<p>Hello my name is greg and i am a very good actor.</p><p>I am also a cooking enthusiast who once came 2nd place on Come dine with me :) 

is received in clickToEditInfo.php

how do i fix this?

  • 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-10T17:24:48+00:00Added an answer on June 10, 2026 at 5:24 pm

    Escape the post data before sending it over POST

    var html = escape($('#info').getCode()); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this very strange problem while compiling the project. MOC seems to be
I have an issue that seems like very flaky behavour, is this a problem
This is a very strange problem. I've got a rails app in which I
I have a very strange memory leak problem, it seems that sqlite3_step is doing
We have a very strange problem which we have yet to be able to
This seems like a very strange problem. I'm stress testing my neo4j graph database,
First off, thanks to whomever is reading this. I have a very strange problem
This problem seems very simple to me, but I've been unable to fix it,
I have a very strange problem,I don't know whether it is awkward to normal
I have very strange problem with mySQL and simple query with simple index. I

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.