Avihai Posted May 20, 2008 Share Posted May 20, 2008 Hi all, I have a string that is being pulled from the db (example: Q"A) and as I echo it it works fine. The problem is when I send this string as a var to my email, I get only the Q because of the quote sign. Is there ANY way to take the var as is (Q"A) by disregarding the quotes in the string??? Thanks, A.O Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/ Share on other sites More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 um...quotes shouldn't be a problem....can you show some code? Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546008 Share on other sites More sharing options...
Avihai Posted May 20, 2008 Author Share Posted May 20, 2008 It is mostly in Hebrew, but check this out: // this is the data that is being transmitted via hidden field on a form $fLecture = $_POST['Lname']; all I need is to echo $fLecture without having the quote sign breaking the string. Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546018 Share on other sites More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 ah...the problem is in your hidden field, make sure you escape it there: <input type="hidden" value="Q"A" /> if it's a php variable echoing into the value, use: <?php $var = 'Q"A'; echo '<input type="hidden" value="'.htmlspecialchars($var).'" />'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546047 Share on other sites More sharing options...
Avihai Posted May 20, 2008 Author Share Posted May 20, 2008 Thanks it is way better now, but now I have a slash before the quotes (Q\"A) :-) any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546081 Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 if slashes are added to your POST vars and you want to remove them, use stripslashes(): $some_val = stripslashes($_POST['some_val']); Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546085 Share on other sites More sharing options...
Avihai Posted May 20, 2008 Author Share Posted May 20, 2008 THANKS (rhodesa and BlueSkyIS) - issue solved and learned new things :-) Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546090 Share on other sites More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 if slashes are added to your POST vars and you want to remove them, use stripslashes(): $some_val = stripslashes($_POST['some_val']); stripslashes should work, but the better option (if you can do it) is to turn off magic_quotes: http://us3.php.net/manual/en/security.magicquotes.disabling.php Quote Link to comment https://forums.phpfreaks.com/topic/106521-solved-double-quotes/#findComment-546128 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.