thecommonthread Posted February 17, 2010 Share Posted February 17, 2010 I have a hidden field in my HTML form that has a single quote (') in the value. When I use that value on a next page, it is parsing it with a blackslash automatically, so on the page, it'll like one of the following examples: 4\' Board Sally\'s plate What code do I use to prevent this? I've run into this problem before and it sure seems like an easy fix, but I still haven't been able to crack it. Any help would be greatly appreciated. Thanks, thecommonthread Quote Link to comment https://forums.phpfreaks.com/topic/192319-issue-with-quotes-when-transferring-between-html-form-and-php/ Share on other sites More sharing options...
teamatomic Posted February 17, 2010 Share Posted February 17, 2010 Thats probably because magic_quotes_gpc is on. If its your server then you can turn that off in php.ini. Alternatively you can use stripslashes() HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/192319-issue-with-quotes-when-transferring-between-html-form-and-php/#findComment-1013460 Share on other sites More sharing options...
SpankMarvin Posted February 17, 2010 Share Posted February 17, 2010 Whack it in an if clause: if(get_magic_quotes_gpc()){ // Automatic adding of slashes? If so, strip em first $string = stripslashes($string); } You can turn that into a function too, to save yourself time... Quote Link to comment https://forums.phpfreaks.com/topic/192319-issue-with-quotes-when-transferring-between-html-form-and-php/#findComment-1013552 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.