I am generating radio buttons based on an XML config values. Sometimes they have apostrophes in the text. When manipulating this data in PHP, I seem to lose everything after the apostrophe. For example:
<input type='radio' name='remove[]' value='Government wants to limit employers' communications about unionization'>
But when dumping it out after the form POSTs, I get this value:
array(1) {
[0]=>
string(35) "Government wants to limit employers"
}
Any suggestions on how to preserve the full string? Thanks!
use
htmlspecialchars():It’s explicitly intended to allow safe insertion of arbitrary text into html without ‘breaking’ the html. Note the ‘ent_quotes’ option. By default htmlspecialchars will only handle
<>", but since you’re using', you need the option to tell htmlspecialchars to handle those too.