Param Veer
Param Veer

Reputation: 786

retrive html data from database in correct format when htmlspecialchars was used while inserting the data

hello i was trying to insert whole html data into database for which i used

$details = htmlspecialchars(stripslashes(mysql_real_escape_string($_POST['message'])));

which seem to work fine as before it was giving error as there were extra "" while inserting the html for eg "<p>hello</p>" so by using the above it got inserted by now when i am trying to retrieve the data its not coming in correct format.

can some one point me what to use with <?php echo $row['details']; ?> to get the correct html format

Upvotes: 0

Views: 300

Answers (1)

Sumit Bijvani
Sumit Bijvani

Reputation: 8179

Don't use stripslashes. because mysql_real_escape_string put / before each quote (" '). when you use stripslashes, it will remove that slashes. so you dont get proper output

Upvotes: 1

Related Questions