Saving nicedit textarea content into mysql database

I'm sort of a newbie so I would appreciate a very clear explanation, thanks in advance.

I'm using the nicedit textarea on a website, the information to be read could contain:

  • Just plain text (user formatted)

  • text and images together

I'm using a mysql database and I don't know how to save the content of the textarea in a way that:

  • the text can be read from the database without loosing the users formatting
  • the images in the textarea can be stored into the filesystem and reloaded when the text is being read back from the database (and putting the images in the position the user intended).

I'm using php if that's needed information.

I hope someone understands what I'm trying to get, any help is appreciated even if it's suggesting another approach ...

Answers:

Answer

You do not need to worry about saving the content because NicEdit saves all text & styles in HTML format. That HTML can easily be saved into a Text field in your database. The problem is that NicEdit does not sync the styling into the original text area, So when you submit the form the content is saved without the styling.

To solve this, you need to explicitly ask NicEdit to save the styling before you submit the form by adding this line:

nicEditors.findEditor('<you_textarea_id>').saveContent();

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.