Getting rid of extras "slashes?"

Hi! I’m rather new to PHP, but I created a series of pages that gather (through a series of forms) information in “$_Session” variables, and then displays it back to the user before confirmation and emailing the collected contents of all the variables.

These pages worked fine on a server at another host, but here at DH, it adds in extra “slashes” when it stores the form fields in the variables so that:

This is just “perfect” I’m impressed, but not completely!


This is just “perfect” I’m impressed, but not completely!

I have a feeling this is because “magic_quotes” is turned on in the php.ini file, but I have no idea how to turn this off?

Can anyone help? Thanks!


You could use stripslashes for your variable:
print stripslashes($yourvariable);


You can disable this behavior by using ini_set() in your global header or library file.

If you want useful replies, ask smart questions.

Chells’ solution did the trick for me. Thanks!

I’d look into using ini_set(), but I’m not sure where to begin with that. Maybe it’s me, but it seems the PHP man assumes alot of a priori knowledge.

For instance, where do you use php_ini? Is it in the .php page with the script, in a htaccess file in the directory, or is it elsewhere on the server?

I find their definitions as useful as “The color red is the same as the color blue, except it has a wavelenth 175 nm longer than that of blue light.”

Assumes you know the wavelength of blue light, and STILL doesn’t necessarily tell you what Red light looks like, or info that might be more useful in the “real world”. sigh

Guess I’ll just continue to slog my way through… :}