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


$userid=$_SESSION["userid"];
$today=date("d-m-Y");
$class_name=$_POST["class_name"];
$month_name=$_POST["month_name"];
$camp=$_POST["camp"];
$sql = "select * from admission where class_name='$class_name' and camp='$camp' and user_id='$userid'";
$admission=mysql_query($sql) or die("Error : " . mysql_error());
    
while($ppp=mysql_fetch_array($admission))
{
$rollno=$ppp["std_rollno"];
$stdname=$ppp["std_name"];
$fname=$ppp["father_name"];
$cell=$ppp["cell_1"];
$cell_2=$ppp["cell_2"];

     
	$sql = "Insert into attendence (id,date,rollno,stdname,fname,cname,status,month_name,cell,user_id,camp,cell2) values (null,'$today','$rollno','$stdname','$fname','$class_name','P','$month_name','$cell','$userid','$camp','$cell_2')";
mysql_query($sql) or die("Error : " . mysql_error());


	 }
	echo "Attendence Genrate Sucessfully";
?>
<a href="attendence.php"> Back </a>