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;
}
?>