View Single Post
Old 10-17-2012, 06:37 PM   PM User | #10
havish
New Coder

 
Join Date: Jul 2012
Posts: 26
Thanks: 1
Thanked 0 Times in 0 Posts
havish is an unknown quantity at this point
This is how the staff takes attendance..
Code:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
 $('#datepicker').datepicker({
	dateFormat: 'yy-mm-dd',
	changeMonth: true,
			changeYear: true});   
});

</script>
PHP Code:
$report = mysql_query("SELECT id, studname, studroll FROM student ") or die(mysql_error());
echo '<form action="" method="post">
      Please select date :<input name="date" id="datepicker" type="text" />
      <table width="600" border="2">
      <tr>
          <th width="83" scope="col">ID</th>
         <th width="83" scope="col">Student Name</th>
    <th width="55" scope="col">Student Roll.No</th>
    <th width="51" scope="col">Attendance</th>
   </tr>';
   while(list($id, $studname, $studroll) = mysql_fetch_row($report))
   {
     echo '<tr>
                <td>'.$id.'</td>
                <td>'.$studname.'</td>
                <td>'.$studroll.'</td>
                <td><input type="hidden" name="att['.$id.']" value="0"/><input type="checkbox" name="att['.$id.']" value="1"/></td>
           </tr>';
   }
   echo '</table><input type="submit" name ="submit2"  id="submit2" value ="submit"></input>
</form>';
?>
<?php
$date 
date($_POST['date']);




$att $_POST['att'];
foreach(
$att AS $key => $value)
{
 
$attendance  =$value 'P' 'A';
$query "INSERT INTO `samp`(`stud_id`,`attendance`,`date`) VALUES ('".$key."','".$attendance."','".$date."')";
 
mysql_query($query);
     
}
havish is offline   Reply With Quote