I searched the site and didn’t find a solution. My problem is that I’ve got a hidden input that I want to send via the post method that has quotes in it. I’ve tried using addslashes() and I get the same problem. It looks something like this right now:
<?php $value = 'I\'ve got \"some\" random text with quotes'; ?>
<input name="example" value="<?=$value?>">
And I get most of the the text showing in my form because the quotes aren’t being ignored AARGH! 😉 So how to I get text with quote into a hidden input?
Thanks in advance!
I would convert them so they validate and avoid confusion:
Try to avoid using double quotes with PHP strings, as PHP will search the entire string for a variable to parse, regardless if the string contains one. They are slower than single quotes. Not so much anymore these days, but still a good practice to use single quotes for strings.