Page 1 of 1

PHP replacing ' and " with \' and \" ..can it be s

Posted: Tue Aug 27, 2002 11:07 am
by Gen-ik
I've got a message forum on the site I'm making at the moment.

The user adds a message using a standard form.

The message gets saved to a .txt file.

Now, for some reason PHP keeps replacing ' and " symbols with '' and \" ..is there any way to stop this?

I'm using the standard PHP command to strip out any HTML code from the users message.

Any ideas?

Posted: Tue Aug 27, 2002 11:40 am
by hob_goblin

Posted: Tue Aug 27, 2002 11:43 am
by volka
are you using addslashes?

try htmlentities()

Posted: Tue Aug 27, 2002 12:33 pm
by Gen-ik
Thanks.. the stripslashes function worked. Don't know how I missed it in the first place! Oh well.

Posted: Tue Aug 27, 2002 3:15 pm
by Takuma
You have the magic quote in PHP that's why it does that.

Posted: Wed Aug 28, 2002 9:25 am
by gotDNS

Code: Select all

$forminfo = stripslashes($forminfo);
then add $forminfo to the text file.