Hi all, i would like to ask, how to insert the CHECKED check box date value into database (checked_table) and insert the UNCHECKED check box date value into database (unchecked_table)?
can someone please assist me on this matter? if my code is as shown below:- thank you very much.
$startDate = strtotime($datefrom); $endDate = strtotime($dateto); $date = $startDate; while( $date <= $endDate) { echo "<input type='checkbox' name='date' value ='".date('d-m-Y', $date)."' class='chk'>";echo date('d-m-Y', $date) .' '; $date = strtotime('+1 day', $date); }
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script><script src="http://code.jquery.com/ui/1.9.1/jquery-ui.min.js" type="text/javascript"></script><script type="text/javascript"> $(document).ready(function () { $("#submit_hod").click(function() { getValueUsingClass(); }); }); function getValueUsingClass(){ var chkArray = []; $(".chk:checked").each(function() { chkArray.push($(this).val()); }); var selected; selected = chkArray.join(',') + ","; if(selected.length >= 1){ alert ("done insert selected date"); }else{ alert ("error"); }}</script>
<label>Date:- FROM</label><input type="date" name="ldatefrom" value="<?php echo $leavedatefrom;?>"><label>TO</label> <input type="date" name="ldateto" value="<?php echo $leavedateto;?>"><input id="submit_hod" type="submit" name="submit">