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



$userid=$_SESSION["userid"];
$today=date("d-m-Y");
$month_name=$_POST["month_name"];
$status=$_POST["status"];
$teacher_id=$_POST["teacher_id"];
$sql = "select * from teacher where teacher_id='$teacher_id' and user_id='$userid'";
$data=mysql_query($sql);
$found=mysql_num_rows($data);
$ppp="";
 if($found==1)
 {
 $ppp=mysql_fetch_array($data);
$tech_name=$ppp["tech_name"];
$father_name=$ppp["fname"];
$cell_no=$ppp["cell_no"];
  
	$sql = "Insert into tech_attendence (id,date,teacher_id,tech_name,fname,cell_no,month_name,status,user_id) values (null,'$today','$teacher_id','$tech_name','$father_name','$cell_no','$month_name','$status','$userid')";
mysql_query($sql) or die("Error : " . mysql_error());

	echo "Attendence Genrate Sucessfully";
	}
	else
	{
		echo "Wrong Teacher Id";
	}

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