How to Insert Checkboxes in each cell of codeigniter calendar


I am building attendance system for employees. where i would like to store the records of the days into sql if it a holiday. So i would like to have checkboxes with each day and when i submit the data i want to store the data of checked boxes. For ex. there is calendar of sep-2015 and there are holidays for 17th and 25th of september so i will check those two days checkboxes and the record i want to store is like

  1. 2015-09-17 1
  2. 2015-09-25 1

where 1 means its a holiday on that day.

Calendar with checkboxes codeigniter

<p ><div class="col-lg-8"><table class="table table-striped table-bordered table-hover">

<tr>
<th class="center" ><a  href="http://localhost/bioattendance/admin/updatecalendar/2015/08">&lt;&lt;</a></th>
<th class="center" colspan="5">September&nbsp;2015</th>
<th class="center"><a  href="http://localhost/bioattendance/admin/updatecalendar/2015/10">&gt;&gt;</a></th>
</tr >

<tr>
<td >Monday</td><td >Tuesday</td><td >Wednesday</td><td >Thursday</td><td >Friday</td><td >Saturday</td><td >Sunday</td>
</tr>

<tr>
<td>&nbsp;</td><td> <div>1<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>2<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>3<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>4<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>5<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>6<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td>
</tr>

<tr>
<td> <div>7<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>8<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>9<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>10<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>11<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>12<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>13<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td>
</tr>

<tr>
<td> <div>14<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>15<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>16<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>17<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>18<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>19<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>20<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td>
</tr>

<tr>
<td> <div>21<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>22<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>23<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>24<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>25<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>26<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>27<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td>
</tr>

<tr>
<td> <div>28<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>29<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td> <div>30<div  class="cbx"><input type="checkbox" name="holiday[]" /></div></div>
   </td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
</tr>

</table></div></p>

Answers:


Here is the code in AJAX for your query.

1] View Code: 2] AJAX Code:

View Code

AJAX code