Jump to content

"stripslashes" when to use it


suttercain

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.