CONTENTEDITABLE div将数据发布到PHP

I have searched a lot and still unable to find any solution to my need.

I have content editable div which collects reviews from my user.The inner HTML is copied to textarea by jquery and then form is posted.

Now at the PHP end I am not sure how to go ahead with this "textarea" posted data.

  1. Checks if any harmful scripts are not available.
  2. How this data is stored safely in SQL database so when retrieved it displays with existing html tags like <span>,<b>,<i>,<u> and <img>

Any help will be grateful.

The content of the TEXTAREA is simple text. There are a number of ways to protect yourself from SQL Injection and other harmful user entered data.

  1. Use mysql_real_escape_string() to safely enter data into your database. If you are using MySQLi, this would be $mysqli->real_escape_string().

  2. Use htmlentities() to convert special characters to their HTML ASCII equivalents.

http://php.net/manual/en/function.mysql-real-escape-string.php

http://php.net/manual/en/function.htmlentities.php

This will allow you to store whatever the user enters in your DB safely. When you display it on your page, say as a comment, you can then html_entity_decode() to return the ASCII back into HTML and then use strip_tags() to flush out things like SCRIPT or EMBED or any other HTML Tags you do not want user to be use on your page (like the comment by @ismael_miguel suggested).