<?php 
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		
		
		 $my=$month_name . " " . $year;
		 
		$ttime=date("h:i:sa");
$userid=$_SESSION["userid"];
$status=$_POST["status"];
$lttime=$_POST["lttime"];
$ttime=$_POST["ttime"];
$rfid=$_POST["rfid"];
$rfid=round($rfid);
$adate=$_POST["adate"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
  


  $a=0;


  $sqlchallan = "SELECT * FROM teacher where status='Active' and user_id='$userid'";
$resultchallan=$conn->query($sqlchallan);
while($rowchallan = $resultchallan->fetch_assoc())
 
  {
 
$id=$rowchallan['id'];

$std_name=$rowchallan['tech_name'];
$fname=$rowchallan['father_name'];
$cell_1=$rowchallan['cell_no'];
$class_name=$rowchallan['class_name'];
$teacher_id=$rowchallan['teacher_id'];


$sql = "Insert into attendence_tech (id,date,rollno,stdname,fname,class_name,cls_sec,status,month_name,cell,user_id,sess1,rfid,portal_id,ttime) values (null,'$adate','$id','$std_name','$fname','$class_name','$cls_sec','$status','$my','$cell_1','$userid','$year','$teacher_id','In Time','$ttime')";
$conn->query($sql);

 }
echo "Teacher Attendance Genrate Sucessfully";

?>
<a href="Open_Teacher_Attendance.php">Back</a>
