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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

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

Post 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.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post 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'>";
Post Reply