Quotes in form variables

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
EricGen
Forum Newbie
Posts: 11
Joined: Tue Jul 15, 2003 4:18 am

Quotes in form variables

Post by EricGen »

Hi,

Everytime there is a quote in a form parameter, the variable I get, whether passed as post or get, has the quote preceeded by a \

This is a pain as then it is written as such in the database. Is there something I should do to ensure the variables I get are exactly what the user typed? If the form is resubmitted I end up with tons of \

Thanks
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

probably stripsplashes will help you
string stripslashes ( string str)

Returns a string with backslashes stripped off. ('' becomes ' and so on.) Double backslashes are made into a single backslash.
--quote from php.net
EricGen
Forum Newbie
Posts: 11
Joined: Tue Jul 15, 2003 4:18 am

Post by EricGen »

yes thanks. For now I was using str_replace which of course doesn't help if the user does enter some \
Post Reply