Removing slashes

From: Date: Sun, 13 Apr 2003 17:44:09 +0000
Subject: Removing slashes
Groups: php.general 
Request: Send a blank email to php-general+get-143680@lists.php.net to get a copy of this message
Hi all, I am a new learner who's become confused by the following problem: I expected the following script ADD/REMOVE the slash sign into/from variables $A and $B. It adds but doesn't remove the slash sign. __________________________________________ <? $A = addslashes($A); $B = addslashes($B); echo htmlspecialchars (stripslashes($A)); echo htmlspecialchars (stripslashes($B)); ?> __________________________________________ By using this form: __________________________________________ <html> <body> <form action="http://localhost/test.php" method="post"> Enter the A and B: <br> A : <input type="text" name="A" size="5"> <br> B : <input type="text" name="B" size="5"> <br> <input type="submit" value="Submit"> </form> </body></html> __________________________________________ This problem can be solved by following changes: (Creating to new variables) $A1 = addslashes($A); $B1 = addslashes($B); which are against the examples I've seen. Would you please tell me what the reason is? Is this because the output doesn't come from a database?? (These variables must later insert into a MySQL table!) I appreciate your comment on this question. Sam <---------- END OF THE FIRST MESSAGE -------------------> _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

« previous php.general (#143680) next »