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

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$userid=$_SESSION["userid"];

$class_name=$_POST["class_name"];
$tdays=$_POST["tdays"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
  
  
  $sqlchallan = "SELECT * FROM admission where class_name='$class_name' and status='Active' and user_id='$userid'";
$resultchallan=$conn->query($sqlchallan);
while($rowchallan = $resultchallan->fetch_assoc())
 
  {
  $adm_no=$rowchallan["adm_no"];
$portal_id=$rowchallan['portal_id'];
$std_name=$rowchallan['std_name'];
$fname=$rowchallan['fname'];
$cls_sec=$rowchallan['cls_sec'];
$cell_1=$rowchallan['cell_1'];
$rfid=$rowchallan['rfid'];


$sql = "Insert into atten (id,date,month_name,class_name,std_rollno,std_name,father_name,cell_1,total_mark,user_id,sess1,cls_sec) values (null,'$today','$month_name','$class_name','$adm_no','$std_name','$fname','$cell_1','$tdays','$userid','$sess1','$cls_sec')";
$conn->query($sql);

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

?>
