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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.