note 26526 deleted from function.addslashes by philip

From: Date: Tue, 20 Jul 2004 17:17:47 +0000
Subject: note 26526 deleted from function.addslashes by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73711@lists.php.net to get a copy of this message
Note Submitter: carsten@cyberxct.com ---- If you want to display the data posted by a form, and insert it in a mysql database, the slashes will not be stripped by stripslashes if magic_quotes_gpc is enabled. i.e. $data = addslashes($data); \\ insert into mysql $sql.. ; \\stripslashes to display data $data = stripslashes($data); echo "$data"; Will display the data posted from the form WITH the slashes, it doesn't work. It will work if you do it like this: // deletes the slashes automaticly inserted if magic_quotes_gpc is set to 1 $displaydata = stripslashes($data); // adds the slashes before insertion in the database $data = addslashes($data); // insert into mysql $sql.. ; echo "$displaydata"; Will display the data WITHOUT the slashes, but the data is inserted into the mysql database WITH the slashes.

« previous php.notes (#73711) next »