problems with htmlspecialchars
<p>I am generating links from the following php code. The links appear in the browser, and the generated html code seems fine, however the links are not click-able. I have tested this in IE and FF, and tried to see with FireBug to no avail.</p>

<p>The code to generate my form</p>

<pre><code>$uploadhtml = htmlspecialchars(json_encode("&lt;form action='up.php' method='post'
enctype='multipart/form-data'&gt;
&lt;label for='file'&gt;Filename:&lt;/label&gt;
&lt;input type='file' name='file' id='file'/&gt; 
&lt;br /&gt;
&lt;input type='hidden' name='pk' value='".$pk."'&gt;
&lt;input type='hidden' name='username' value='".$USERNAME."'&gt;
&lt;input type='submit' name='submit' value='Submit' onclick=\"setTimeout(function() { 
updateByPk('Layer2', '".$pk."', '".$brand."', '".$pg."'); } ),1250);\" /&gt;
&lt;/form&gt;"), ENT_QUOTES);
</code></pre>

<p>The resultant html code:</p>

<pre><code>    &lt;a onclick="makewindows(&amp;#39;&amp;quot;&lt;form action=&amp;#39;up.php&amp;#39; method=&amp;#39;
post&amp;#39;\r\nenctype=&amp;#39;multipart\/form-data&amp;#39;&gt;\r\n&lt;label for=&amp;#39;
`file&amp;#39;&gt;Filename:&lt;\/label&gt;\r\n&lt;input type=&amp;#39;file&amp;#39; name=&amp;#39;file&amp;#39; id=&amp;#39;`file&amp;#39;\/&gt; \r\n&lt;br \/&gt;\r\n&lt;input type=&amp;#39;hidden&amp;#39; name=&amp;#39;pk&amp;#39; value=&amp;#39;
380118179930&amp;#39;&gt;\r\n&lt;input type=&amp;#39;hidden&amp;#39; name=&amp;#39;username&amp;#39; value=&amp;#39;
janmaybach&amp;#39;&gt;\r\n&lt;input type=&amp;#39;submit&amp;#39; name=&amp;#39;submit&amp;#39; value=&amp;#39;
Submit&amp;#39; onclick=\&amp;quot;setTimeout(function() { updateByPk(&amp;#39;Layer2&amp;#39;, 
&amp;#39;380118179930&amp;#39;, &amp;#39;Ed Hardy&amp;#39;, &amp;#39;1&amp;#39;); } ),1250);\&amp;quot; 
\/&gt;\r\n&lt;\/form&gt;&amp;quot;&amp;#39;); return false;" href="#"&gt;Upload files&lt;/a&gt;
</code></pre>

<p>I guess it's a JavaScript error, but I don't know how to pinpoint it?</p>

<p>edit: The html code without ENT_QUOTES:</p>

<pre><code>&lt;a href="#" onclick="makewindows('&amp;quot;&lt;form action='up.php' method='post'\r
\nenctype='multipart\/form-data'&gt;\r\n&lt;label for='file'&gt;Filename:&lt;\/label&gt;\r\n&lt;input 
type='file' name='file' id='file'\/&gt; \r\n&lt;br \/&gt;\r\n&lt;input type='hidden' name='pk' 
value='380118185183'&gt;\r\n&lt;input type='hidden' name='username' value='janmaybach'&gt;\r
\n&lt;input type='submit' name='submit' value='Submit' onclick=\&amp;quot;setTimeout(function() 
{ updateByPk('Layer2', '380118185183', 'Ed Hardy', '1'); } ),1250);\&amp;quot; 
\/&gt;\r\n&lt;\/form&gt;&amp;quot;'); return false;"&gt;Upload files&lt;/a&gt;
</code></pre>

<p>It still is not clickable..., everything seems to be quoted correctly?</p>

<p>When I try without  htmlspecial chars, the following html output is produced:</p>

<pre><code>&lt;input type='submit' name='submit' value='Submit' onclick=" settimeout(function()="" {="" updatebypk(="" layer2="" 380118179930="" ed="" hardy="" ,="" 1="" );="" }="" ),1250);=""&gt;
'); return false;"&amp;gt;Upload files&lt;/a&gt;
</code></pre>
