stripslashes() after using addslashes()

by rajesh 2009-10-29 10:31:32

I have noted in many places including hiox.org that we have not used stripslashes() while we display a content from database.

i.e When I try to add a scrap with some word like "it's", it adds properly. So we have used addslashes to insert this content in to db.

But when i try to edit this scrap it shows as \"it\'s\".
This is an issue..

We should have used stripslashes() before displaying the content.

Example Code:
$value = "it\'s test";
$result = stripslashes($value);

print "before stripslashes() -".$value;
print "after stripslashes() -".$result;
?>

Output of the above code:
before stripslashes() - it\'s test
after stripslashes() - it's test

Tagged in:

1077
like
0
dislike
0
mail
flag

You must LOGIN to add comments