PHP calender with Checkbox: How to populate checkbox from mysql
<p>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.</p>

<pre><code>&lt;form name="form1" method="post" action="show.php"&gt;
&lt;?php

$year = "2011";
$month = "8";
$d = cal_days_in_month(CAL_GREGORIAN, 1, 2011);

$i=1;
while ($i &lt;= $d) { ?&gt;
    &lt;input type="checkbox" name="date[]" value="&lt;? echo  " $year-$month- " . $i . "";  ?&gt;"&gt;
    &lt;? echo  " $year-$month- " . $i . "" . "&lt;br&gt;"; ?&gt;
    &lt;?
    $i++;
}

?&gt;
 &lt;input type="submit" name="Submit" value="Submit"&gt;
&lt;/form&gt;
</code></pre>
