Saving nicedit textarea content in mysql database

I'm kind of a beginner, so I would really like to get a very clear explanation, thanks in advance.

I am using a nicedit text area on a website, the reading information could contain:

  • Just text (user-formatted)

  • text and images together

I am using mysql database and I have no idea how to store the contents of the textbox in such a way that:

  • the text can be read from the database without loss of user formatting.
  • the images in the textbox can be saved to the file system and reloaded when reading text from the database (and placing the images at the position the user intended).

I use php if you need information.

I hope someone understands what I am trying to get, any help is appreciated even if it suggests a different approach ...

+3


source to share


1 answer


You don't need to worry about saving content because NicEdit saves all text and styles in HTML format. This HTML code can be easily saved to a text box in your database. The problem is that NicEdit doesn't sync the style to the original text area, so when you submit the form, the content is saved without styling.

To solve this problem, you need to explicitly ask NicEdit to save the style before submitting the form by adding this line:



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

      

+2


source







All Articles