Page 1 of 1

I get a slash before my single quotes...what the hell ?

Posted: Tue Aug 20, 2002 10:59 pm
by HUWUWA
Hi guys, I have a form that people can send me messages with, I just take the message, make it a string and use the mail() function. But if they enter something like "I've" it comes out: I''ve with a slash.

Do I have to pass it through a function to parse the quotes, kinda like when you make an SQL query string ? What if they use double quotes like "Death", or even a combo of single and double quotes like "Death's Kid" ?

What should I do ? Thanks.

Posted: Tue Aug 20, 2002 11:07 pm
by nielsene
This is the "Magic Quotes" feature of PHP, desinged to make it easy to pass form input into databases. stripslashes() should be able to undo it. You could also look at set_magic_quotes_runtime() to see about disabling this feature on your paticular script.

I've never tried disabling, stripslashes has always worked for my needs.

Posted: Tue Aug 20, 2002 11:18 pm
by gotDNS
PHP add's those, etc. so that ur not ending the started ones....single quotes should also work....like:

Code: Select all

echo "<input type='text'>";