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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.