thanks for your reply. Okay, got it. But I guess that's not going to help me do what I want to do. Instead of performing a running tally, I guess I need instead to return the total for each instance of the loop and then set the number back to 0, or something. I want to do something like this: [code]<input name="<?php echo $row_Recordset1['schedule_id']; ?> " type="checkbox" id="<?php echo $row_Recordset1['schedule_id']; ?>" value="<?php echo $row_Recordset1['class_name']; ?>" <? if the schedule_id number IS found somewhere in the array item, echo "checked onClick=goSomeWhere"; if the schedule_id number is NOT found in the array item, echo "onClick=goSomeWhereElse"; ?> >[/code]