Where is this strange code coming from in my php/mysql app and how do I get rid of it?

Last week, Thursday to be exact, the autogen php/mysql web form we have has a textarea field where we use tinyMCE to allow client to input and format their text. Suddenly on Thursday the text would not appear in the form, along with the border that surrounds the textarea data in display mode, but when we went to the edit screen where the tinyMCE field is, we could see the text. I came in today and looked at the db and see all this odd code in the db [see below].  Think the user copied and pasted some word doc into the field, but now now matter what I get that odd code.

I have overwritten the code with straight, clean text, load the page it work, but then it eventually reverts to this odd code-- and at some point you refresh your browser and no longer see any text from the php form. When I look in the db again, all this code[see below]is back in the field.

I been surfing/researching and various suggestions include updating tinyMCE, which I did, but same things happens.

Does anyone have any idea what I should do, what part of the code to attack, is it the db or the tinyMCE? All help is much appreciated. [Note: app has been running successfully for about 2 years.]

Example of Code:
<p><!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG />
> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml>
> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom>
> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning />
> <w:ValidateAgainstSchemas />
> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
> <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
> <w:DoNotPromoteQF />

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
It is a problem with your content placed from MS Word document etc.,   Before you copy/paste to the editor .. you need to strip or remove those word formatting .. there is feature in CKEditor.
These are html comments that has been included for being used in copy paste.
You should provide provision to strip such comments by using
html = html.replace("(?s)<!--\\[if(.*?)\\[endif\\] *-->", "") in a java script.
and it will take care of  such insertions.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
I can't vouch for this, but it seems promising.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

justmelatAuthor Commented:
Hi Ray

I tried adding paste in the init but something is still off in this:
After many hours of this, here is another kink.  In more researching I found some issues with copy/paste in tinyMCE, so in a desperate move, I took the clients' text and just re-typed it in myself, adding no formatting.  

I started paragraph by paragraph.  The first one went in/displayed fine, as well as the second, third, all the way to the 6, when I got to the seventh paragraph, saved everything, went back to the form to view, nothing from the textarea field would display.  There is even a border around this section, it would not display.  I went back to the db, all the text is still there [no funky MS code], but will not display on the form.  Are there some limitations as it relates to the textarea field that I am not aware of?  

I have increased the column rows to 30 for the textarea field, changed the field type in the db from a **text** field to a **mediumtext** field.  Did all that and still, once I get to a certain point, nothing displays.  Any suggestions on what I am missing?
Ray PaseurCommented:
No suggestions, sorry.  I have never seen TinyMCE malfunction in the way you describe.  And with only a few paragraphs of data you are certainly not hitting limits that would lead to data truncation.

My experience with TinyMCE goes like this.  If you are a really naive client, you will just type your information into the textarea and everything will work well.  If you are a really sophisticated client you will know well enough not to paste MSFT formatting into any textarea and everything will work well.  But if you're both clever and unsophisticated you can screw things up completely.  

I once wrote a CMS for a client who insisted on doing their own updates to the web pages.  After about two months of destroying the formatting and content of their pages, they gave up and went back to paying me to do their updates.  I think if they had just spent the two months learning a little HTML they would have been way ahead!  That's probably not going to help you solve your TinyMCE issues, but at least you know that you have company in those trenches.
justmelatAuthor Commented:
LOL - good one Ray.  The tinyMCE has been in place and working for two years, so not sure what changed so much, except that originally the client did copy/paste from a word doc.  But now that I have re-typed everything - that issue is no longer relevant.  

And you are right, even with these 8 paragraphs the client has, it't not like a novel or anything. so I don't know what is going on and worse, I can't confirm that it's tinyMCE, or textarea field, or the db or the browsers.  

Not sure which I hate worse, having a big, complex issue to figure out or having a seemingly small issue that takes you thru hundreds of hoops.

Thanks for your comments - I do appreciate your time.
Ray PaseurCommented:
Do you have phpMyAdmin?  If not, get it.  It will give you an easy way to look into the DB and fix things that need hands-on work.
justmelatAuthor Commented:
i have phpAdmin, but also have navicat - really nice, simple db interface.  And from it, I can see that all the text is in the field, it just won't show up on the form at a certain point.
justmelatAuthor Commented:
great as usual
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.