Reputation: 159
For example I writed this text is I don't know and submited it to database. Then I go to page, where this text appears and it show I don\'t know, how can I disable adding backslashes?
code
$text= htmlspecialchars($db['text']);
$textA = array('/\[b\](.*?)\[\/b\]/is');
$textB = array('<b>$1</b>');
$textC = preg_replace($textA,$textB,$text);
echo nl2br($textC);
Upvotes: 1
Views: 4527
Reputation:
Turn magic_quotes off in your .htaccess
file by adding this line:
php_flag magic_quotes_gpc Off
Upvotes: 1
Reputation: 26699
Turn off magic_quotes_gpc and make sure you are not using addslashes before saving to the database
Upvotes: 2