This sounds like a common problem caused by poorly constructed html and an unquoted string. You should look at the source code of your html pages carefully for clues about what is going wrong.
Briefly, these are acceptable to most browsers:
// what you probably have
<input type=hidden value=Several great book titles />
// what you should have
<input type=hidden value="Several great book titles" />
Which might explain why sometimes it seems to just work, and other times it does not.
// a string without a space
<input type=hidden value=Several />
// a number
<input type=hidden value=23 />
This gets especially messy when you start outputting JS and its own quoting needs, then look at using heredoc
// you can quote with single quotes if you want to:
echo "<input type=hidden value='Several great book' titles />". PHP_EOL ;
// OR **
echo '<input type=hidden value="Several great book" titles />'. PHP_EOL ;
echo '<input type=hidden value=\'Several great book\' titles />'. PHP_EOL ;
// OR **
echo "<input type=hidden value=\"Several great book\" titles />". PHP_EOL ;
** these might be the only ones to pass very strict x/html validation.