Checkboxes to an Array then retreiving results.
Hi All,
I have looked through the forum but cannot find an answer for this one using MySqli.
I hve a form that the user fills in one of the questions is
How Long have you been coming to our even?
I have a list of check boxes from a recordset for the year 2000 to the present.
I can successfully input this array into my database but I cannot get it to update to my update page.
so if the user selects
2000,2001,2011,2012,2013,2014,2015
how is this reflected in the user page
I have used a variation on the following
<?php while(!$rsYears->atEnd()) { ?>
<label>
<input type="checkbox"
name="cbAttendedYear[]"
value="<?php echo($rsYears->getColumnVal("year_value")); ?>"
<?php if ((in_array($rsYears->getColumnVal("year_value"), explode(", ", $rsTraders->getColumnVal("trader_Years"))))) {echo "checked=\"checked\"";} ?>
id="cbAttendedYear_<?php echo($rsYears->getColumnVal("yearID")); ?>"><?php echo($rsYears->getColumnVal("year_value")); ?></label>
<?php
$rsYears->moveNext();
}
$rsYears->moveFirst();
?>
I am not sure how to fill the check boxes if a user has saved this info
Thanks
Andy