Form won't pass hidden value
<p>I'm working on a database-driven quiz that lets users select a series of answers, then submit the results via a form. It was working great, when it suddenly blew up, and I haven't been able to find the problem.</p>

<p>So before I get into the more complex stuff, I'd like to go back to square one and just make something simple work - like passing a hidden value to another page that echoes that value.</p>

<p>Here's the code for my first page @ mysite/form.php:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;!-- g1/form.php --&gt;
&lt;div id="quiz" rel="key"&gt;
  &lt;form action="form2.php" method="post" id="quiz"&gt;
    &lt;input type="hidden" name="PreviousURL" id="url" /&gt;
    &lt;input type="submit" value="Submit Quiz" /&gt;
  &lt;/form&gt;
&lt;/div&gt;&lt;!-- quiz-container --&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And here's the code for the second page:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php ini_set('display_errors', 1);

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

echo $_POST['PreviousURL'];
}
echo 'XXX';
?&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I also tried moving the closing bracket, like this:</p>

<pre><code>if ($_SERVER['REQUEST_METHOD'] == 'POST') {
}

echo $_POST['PreviousURL'];
echo 'XXX';
</code></pre>

<p>In both cases, when I click the submit button and am forwarded to form2.php, I see "XXX," but there's no value for $_POST['PreviousURL'].</p>

<p>I must have accidentally deleted or modified something, because it seems so simple, and it worked fine before. Can anyone tell me what the problem is?</p>