I thought someone would pick up the slack here, but apparently nobody is...
<input type="hidden" name="hiddenlogcontents" value="<?php echo $logcontents ?>">
Since you say the first and only character that gets transmitted is "{", I'll make a lucky guess that the log data consists of JSON strings and looks something like this:
{"foo":"bar"...
Well, let's interpolate that data into your HTML to see the result of your code snippet:
<input type="hidden" name="hiddenlogcontents" value="{"foo":"bar"...">
Can you see it here in the SO code highlighter? The value of the value
attribute is "{"
. The rest that follows is incorrectly formatted garbage. You're just creating the attribute value="{"
as far as the HTML parser is concerned.
If you want to embed quotes in HTML attributes, those need to be HTML encoded:
<input type="hidden" name="hiddenlogcontents" value="<?php echo htmlspecialchars($logcontents, ENT_QUOTES); ?>">
Please read The Great Escapism (Or: What You Need To Know To Work With Text Within Text).
Secondarily I'd question how wise it is to transfer huge data blobs this way, forcing the client to download and upload the data repeatedly. But that's another topic...