back slashes being added by php script

back slashes being added by php script

Posted by: bradww
Posted on: 2005-03-18 19:10:00

I have 22 text areas on a web page with the action going to a php script that writes whaever is in the text areas to a web pag.it simply opens files and writes to them, they are html files. the problem i'm having is the scriipt is putting a back slash before double and single quotes. does anybody have an idea why this is happening? There are no rejplace functions in the script. any help would be greatly appreciated.

Re: back slashes being added by php script

Posted by: chell
Posted on: 2005-03-18 19:46:00

How about something like this:

$yourcontent = stripslashes($_POST['yourcontent']);

~Chell
http://www.chellsroost.com

Re: back slashes being added by php script

Posted by: kchrist
Posted on: 2005-03-21 09:15:00

What you're seeing is magic quotes. It's annoying, and encourages bad coding habits. You can disable this behavior by adding the following line to .htaccess at the root of your site:

php_flag  magic_quotes_gpc      off
php_flag magic_quotes_runtime off

Note that PHP must be running as an Apache module, not CGI, for this to work.

Re: back slashes being added by php script

Posted by: bradww
Posted on: 2005-03-21 16:24:00

Thank you both, I was going to ask for an explanation. That's interesting


Tags: php scripthtml filesslashappreciatedquotesideaactionhelp