suttercain Posted April 9, 2007 Share Posted April 9, 2007 Hi everyone, I am 6 weeks into trying to learn PHP and I have an educational question. When should one use stripslashed()? in forms? In forms going to the database? The reason I ask is I have a form with a body section. When I use " I get this on the output "\ But when I use strip slashes that's gone. Should I use this on all form fields? Even in forms that will be submitting data to MySQL? Thanks for the help and explanations. SC Link to comment https://forums.phpfreaks.com/topic/46338-stripslashes-when-to-use-it/ Share on other sites More sharing options...
per1os Posted April 9, 2007 Share Posted April 9, 2007 strip_slashes is a very picky subject. Usually data coming out of forms has slashes, usually. So if you are going to immediately display the data, no database etc, it is proper to strip the slashes. If you are storing that data in a database, nothing is needed as the database likes the slashes to prevent errors, and when you retrieve the data the slashes should be gone. http://us.php.net/manual/en/function.get-magic-quotes-gpc.php I believe that is the reason the strings are escaped. Link to comment https://forums.phpfreaks.com/topic/46338-stripslashes-when-to-use-it/#findComment-225432 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.