I am trying to develop a calender with checkboxes for each date. By checking the check boxes users can insert dates into the database. For that I have written some codes which I have shown below and it is working okay. Now, the problem I am facing is to populate the inserted data in check boxes when people visit the page. I mean I want to have those check boxes selected if their information is already exist in database otherwise I want those to appear as unchecked. I want to show the data in the same page by which users can insert dates. Would you please kindly help me with this. Thanks in Advance.
<form name="form1" method="post" action="show.php">
<?php
$year = "2011";
$month = "8";
$d = cal_days_in_month(CAL_GREGORIAN, 1, 2011);
$i=1;
while ($i <= $d) { ?>
<input type="checkbox" name="date[]" value="<? echo " $year-$month- " . $i . ""; ?>">
<? echo " $year-$month- " . $i . "" . "<br>"; ?>
<?
$i++;
}
?>
<input type="submit" name="Submit" value="Submit">
</form>
you can do something like this