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

date_default_timezone_set("Asia/Karachi");

$userid=$_SESSION["userid"];
$status=$_POST["status"];

$ttime=$_POST["ttime"];
$rfid=$_POST["rfid"];
$date=$_POST["date"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
  
  $a=0;



  $sqlchallan = "SELECT * FROM items where rfid='$rfid' and user_id='$userid'";
$resultchallan=$conn->query($sqlchallan);
while($rowchallan = $resultchallan->fetch_assoc())
 
  {
  $item_name=$rowchallan["item_name"];
  



$sql = "Insert into attendence (id,date,rollno,stdname,fname,class_name,cls_sec,status,month_name,cell,user_id,sess1,rfid,portal_id,ttime) values (null,'$date','$adm_no','$item_name','$fname','$class_name','$cls_sec','$status','$month_name','$cell_1','$userid','$sess1','$rfid','$portal_id','$ttime')";
$conn->query($sql);

 }
header("location:Genrate_Attendance_RF.php");

?>
