checkbox won't uncheck (value still passed
Posted: Fri Dec 09, 2005 9:31 pm
I am populating a checkbox array from a DB pull. Everyting works fine. The checkboxes that have been previously selected show up correctly.
However, if a user unchecks an item and posts the form, the array still shows that item as checked.
Anyone run into this before?
The code below creates the array. ROW holds the record set where the cols are the array items. ROW2 holds the array names from a lookup table.
However, if a user unchecks an item and posts the form, the array still shows that item as checked.
Anyone run into this before?
The code below creates the array. ROW holds the record set where the cols are the array items. ROW2 holds the array names from a lookup table.
Code: Select all
<?
$theCount = 0;
$theTrigger=0;
while ( $Row2 = mysql_fetch_row( $demoResult2 ) )
{
if (round($theMidRow) == $theCount)
{
$theTrigger = 1;
}
if ($theTrigger == 1)
{
echo "</td><td>";
$theTrigger = 2;
}
echo "<input type='checkbox' name='amenities[]' value='".$Row2[2]."' ";
$theArrayIndex = $Row2[4];
if ($Row1[$theArrayIndex] == 1)
{
echo "checked='checked' ";
}
echo "> ".$Row2[1]."<br />";
++$theCount;
}
?>