POST Variables not being passed
<p>I'm trying to pass some POST variables from hidden inputs (using JQuery to change the value of the input according to the text in the td field). I've tested the JQuery and it definitely assigning the inputs the right values, but when I try and assign POST variables according to the values on the previous page, they're not set to the numbers. </p>

<p>Code: </p>

<pre><code>&lt;form method="POST" action="newcriminalreport2.php"&gt;

            &lt;div style="width:800px;text-align:left;margin:0 auto;padding-bottom:5px;"&gt;A. PENDING BALANCE&lt;/div&gt;
            &lt;table border="1" style="width:800px;" ID="tableA"&gt;
            &lt;th style="width:40%;"&gt;&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;CAPITAL&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;NON-CAPITAL&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;TOTAL&lt;/th&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;1. Pending Balance from Previous Month&lt;/td&gt;
            &lt;td id="PendingCapDefs"&gt;123&lt;/td&gt;&lt;input type="hidden" name="PendingCapDefs" id="PendingCapDefsInput"&gt;
            &lt;td id="PendingCapCases"&gt;2&lt;/td&gt;&lt;input type="hidden" name="PendingCapCases" id="PendingCapCasesInput" value=""&gt;
            &lt;td id="PendingNonCapDefs"&gt;3&lt;/td&gt;&lt;input type="hidden" name="PendingNonCapDefs" id="PendingNonCapDefsInput" value=""&gt;
            &lt;td id="PendingNonCapCases"&gt;4&lt;/td&gt;&lt;input type="hidden" name="PendingNonCapCases" id="PendingNonCapCasesInput" value=""&gt;
            &lt;td id="PendingDefsTotal"&gt;5&lt;/td&gt;&lt;input type="hidden" name="PendingDefsTotal" id="PendingDefsTotalInput" value=""&gt;
            &lt;td id="PendingCasesTotal"&gt;6&lt;/td&gt;&lt;input type="hidden" name="PendingCasesTotal" id="PendingCasesTotalInput" value=""&gt;
            &lt;/tr&gt;
            &lt;/table&gt; 

            &lt;br/&gt;&lt;br/&gt;&lt;div style="width:800px;text-align:left;margin:0 auto;padding-bottom:5px;"&gt;B. CRIMINAL CASE ASSIGNMENTS&lt;/div&gt;
            &lt;table border="1" style="width:800px;" ID="tableB"&gt;
            &lt;th style="width:40%;"&gt;&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;CAPITAL&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;NON-CAPITAL&lt;/th&gt;
            &lt;th colspan="2" style="width:20%;"&gt;TOTAL&lt;/th&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;td&gt;Defs&lt;/td&gt;
            &lt;td&gt;Cases&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;2. New Fillings&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgNewCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgNewCapCases"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgNewNonCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgNewNonCapCases"/&gt;&lt;/td&gt;
            &lt;td id="AsgNewTotalDefs"&gt;234&lt;/td&gt;
            &lt;td id="AsgNewTotalCases"&gt;345&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;3. Transfers Received&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgTRCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgTRCapCases"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgTRNonCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgTRNonCapCases"/&gt;&lt;/td&gt;
            &lt;td id="AsgTRTotalDefs"&gt;234&lt;/td&gt;
            &lt;td id="AsgTRTotalCases"&gt;345&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;4. Reopened Cases&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgRCCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgRCCapCases"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgRCNonCapDefs"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="username" size="5" id="AsgRCNonCapCases"/&gt;&lt;/td&gt;
            &lt;td id="AsgRCTotalDefs"&gt;234&lt;/td&gt;
            &lt;td id="AsgRCTotalCases"&gt;345&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;5. Total Cases Assigned&lt;/td&gt;
            &lt;td id="PendingCapDefsTotal"/&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingCapDefsTotal" id="PendingCapDefsTotalInput" value=""&gt;
            &lt;td id="PendingCapCasesTotal"/&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingCapCasesTotal" id="PendingCapCasesTotalInput" value=""&gt;
            &lt;td id="PendingNonCapDefsTotal"/&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingNonCapDefsTotal" id="PendingNonCapDefsTotalInput" value=""&gt;
            &lt;td id="PendingNonCapCasesTotal"/&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingNonCapCasesTotal" id="PendingNonCapCasesTotalInput" value=""&gt;
            &lt;td id="PendingTotalDefs"&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingTotalDefs" id="PendingTotalDefsInput" value=""&gt;
            &lt;td id="PendingTotalCases"&gt;0&lt;/td&gt;&lt;input type="hidden" name="PendingTotalCases" id="PendingTotalCasesInput" value=""&gt;
            &lt;/tr&gt;
            &lt;/table&gt; 

        &lt;br /&gt;
        &lt;div style="text-align:right; width: 900px;"&gt;&lt;input type="submit" value="Save and Continue --&gt;" style="border:none;background-color:transparent;color:blue;text-decoration:underline"&gt;&lt;/form&gt;
</code></pre>

<p>and the next page:</p>

<pre><code>&lt;?php
    session_start();
    $judge = $_SESSION['judge'];
    if(!isset($_SESSION['user'])){
        header( 'Location: index.php'  );
        die();
    }

    // Get line 1 and 5 from first page (to be used in newcriminalreport3 totals)
        $_SESSION['PendingCapDefs'] = $_POST['PendingCapDefs'];
        $_SESSION['PendingCapCases'] = $_POST['PendingCapCases'];
        $_SESSION['PendingNonCapDefs'] = $_POST['PendingNonCapDefs'];
        $_SESSION['PendingNonCapCases'] = $_POST['PendingNonCapCases'];
        $_SESSION['PendingDefsTotal'] = $_POST['PendingDefsTotal'];
        $_SESSION['PendingCasesTotal'] = $_POST['PendingCasesTotal'];

        $_SESSION['PendingCapDefsTotal'] = $_POST['PendingCapDefsTotal'];
        $_SESSION['PendingCapCasesTotal'] = $_POST['PendingCapCasesTotal'];
        $_SESSION['PendingNonCapDefsTotal'] = $_POST['PendingNonCapDefsTotal'];
        $_SESSION['PendingNonCapCasesTotal'] = $_POST['PendingNonCapCasesTotal'];
        $_SESSION['PendingTotalDefs'] = $_POST['PendingTotalDefs'];
        $_SESSION['PendingTotalCases'] = $_POST['PendingTotalCases'];
?&gt;
</code></pre>

<p>Anyone know what's up?</p>

<p>print_r($_POST):</p>

<pre><code>Array ( [PendingCapDefs] =&gt; [PendingCapCases] =&gt; [PendingNonCapDefs] =&gt; [PendingNonCapCases] =&gt; [PendingDefsTotal] =&gt; [PendingCasesTotal] =&gt; [username] =&gt; 0 [PendingCapDefsTotal] =&gt; [PendingCapCasesTotal] =&gt; [PendingNonCapDefsTotal] =&gt; [PendingNonCapCasesTotal] =&gt; [PendingTotalDefs] =&gt; [PendingTotalCases] =&gt; ) 

&lt;script type="text/javascript"&gt;
    $(window).unload( function () {
        // Line 1
        $('#PendingCapDefsInput').val($('#PendingCapDefs').html());
        $('#PendingCapCasesInput').val($('#PendingCapCases').html());
        $('#PendingNonCapDefsInput').val($('#PendingNonCapDefs').html());
        $('#PendingNonCapCasesInput').val($('#PendingNonCapCases').html());
        $('#PendingDefsTotalInput').val($('#PendingDefsTotal').html());
        $('#PendingCasesTotalInput').val($('#PendingCasesTotal').html());

        // Line 5
        $('#PendingCapDefsTotalInput').val($('#PendingCapDefsTotal').html());   
        $('#PendingCapCasesTotalInput').val($('#PendingCapCasesTotal').html()); 
        $('#PendingNonCapCasesTotalInput').val($('#PendingNonCapCasesTotal').html());   
        $('#PendingTotalDefsInput').val($('#PendingTotalDefs').html()); 
        $('#PendingTotalCasesInput').val($('#PendingTotalCases').html());   
    });
&lt;/script&gt;
</code></pre>
