ok I know there's a way around this otherwise radio buttons and checkboxes wouldn't ever be used in forms...so I've been trying to figure this one out...
I have a dynamic form that consists of an associative array. Each row in this form consists of:
name, id, 3 radio buttons (to represent 3 columns in a mysql table), and a text field.
however many names there are is however many rows end up in this table.
My problem is not really much else besides the fact that for some reason false values are not being stored in this array.
for right now I have 17 test names in place, so the table spits out 17 names, id's (as hidden fields), the 3 radio buttons per name, and an input field per name.
when I dump the array on the next page it spits out everything 100% perfect except for the fact that because my false values are not being recorded like they're supposed to be, so the true values get stored at the beginning of the array (name) instead of the spot they should really be stored at.
this causes the person in the first element of name to get the true value instead of, say, the 14th member.
is there any way around this?
for the sake of keeping it simple I'm showing the form and the processing of that form only unless asked otherwise
<?php
while($row = mysql_fetch_assoc($result))
{
?>
<tr>
<td class="hideIt">
<input type="hidden" name="name[name][]" value="<?php echo $row['userName'];?>">
<input type="hidden" name="name[userID][]" value="<?php echo $row['userID'];?>">
<?php echo $row['userName'];?></td>
<td class="hideIt" style="text-align: right;"><input type="radio" name="name[burn][]" value="sea"></td>
<td class="hideIt" style="text-align: right;"><input type="radio" name="name[burn][]" value="sky"></td>
<td class="hideIt" style="text-align: right;"><input type="radio" name="name[burn][]" value="dyn"></td>
<td class="hideIt" style="text-align: right;"><input type="text" class="input" name="name[lastLot][]" value = ""></td>
<?php if($row['lastUpdate']=="0000-00-00") { echo "<td class='hideIt'><i>Member account not approved</i></td>"; }?>
</tr>
<?php
}
echo '<tr><td colspan="5" style="text-align: right" class="hideIt"><input type="submit" value="Update" class="button" /></td></tr>';
echo '</table></form>';
?>
and the processing:
for($i=0; $i<$cap; $i++)
{
$sea = $people['sea'][$i];
$sky = $people['sky'][$i];
$dyn = $people['dyn'][$i];
if(isset($sea))
{
$personID = $_POST['userID'];
$person = $_POST['userName'];
$newSeaTotal = 0;
}
if(isset($sky))
{
$personID = $_POST['userID'];
$person = $_POST['userName'];
$newSkyTotal = 0;
}
if(isset($dyn))
{
$personID = $_POST['userID'];
$person = $_POST['userName'];
$newDynTotal = 0;
}
//mysql queries here dep. on which one was selected
}
any help is appreciated.