retrieving multiple values from checkbox and hidden field
<p>my code works as expected but a little issue occurred, i try retrieving values from checkboxes with same name and hidden fields with the same name, it works but one of the hidden field keeps on returning the first value even if the checkbox was not selected.
here is my code</p>

<pre><code>while($row=mysql_fetch_array($res1)){
?&gt; 
    &lt;tr&gt;&lt;td class='bold'&gt;&lt;?php echo $sn;?&gt;&lt;input type="hidden" name="snum[]" value="&lt;?php echo $sn; ?&gt;" /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $row['subLocationName']; ?&gt;
    &lt;input type="hidden" name="location[]" value="&lt;?php echo $row['dllink_id']; ?&gt;"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="available[]" value="&lt;?php echo $row['subLocationName']; ?&gt;"/&gt;&lt;/td&gt;
    &lt;input type="hidden" name="locationID[]" value="&lt;?php echo $row['locationName']; ?&gt;"/&gt;
    &lt;input type="hidden" name="sublocation[]" value="&lt;?php echo $row['subLocationName']; ?&gt;"/&gt;
    &lt;input type="hidden" name="device[]" value="&lt;?php echo $row['deviceName']; ?&gt;"/&gt;
    &lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;?php
        $sn++;
    }
</code></pre>

<p>the values are from my database.
the retrieving code is this</p>

<pre><code>if(isset($_POST['submit_btn'])){

        $serial_num = $_POST['snum'];
        $locationDeviceLink = $_POST['location'];
        $linkAvailable =$_POST['available'];
        $location = $_POST['locationID'];
        $subLocation = $_POST['sublocation'];
        $device = $_POST['device']; 
        $measure_date = date("Y-m-d");
        $sn = count($linkAvailable);
            for ($i=0; $i&lt;$sn; $i++ ){
                if(!empty($linkAvailable[$i])){
                    echo "serial number:".$serial_num[$i]."  location:".$locationDeviceLink[$i]."  available:".$linkAvailable[$i]."  Location:".$location[$i]."  subLocation:".$subLocation[$i]."  Device:".$device[$i]."  Date:".$measure_date."&lt;br/&gt;";


                }

            }



    }
</code></pre>

<p>the problem is the subLocation value, it keeps returning the first value then the second as it appears even if the associated checkbox is not checked and another checkbox is checked, please can anyone help me out, cant't think of anything more.
thanks in advance
joseph O</p>
