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

$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$sub_name=$_POST["sub_name"];
$exame_term=$_POST["exame_term"];
$month_name=$_POST["month_name"];
$class_name=$_POST["class_name"];
$pass_mark=$_POST["obt_mark"];
$total_mark=$_POST["total_mark"];
$sess1=$_POST["sess1"];

 $sql1 = "select * from addsubject where subname='$sub_name' and user_id='$userid'";
   $std_ledger1=mysql_query($sql1) or die("Error : " . mysql_error());
   $app1=mysql_fetch_array($std_ledger1);
   $subid=$app1["id"];

$sql = "select * from admission where class_name='$class_name' 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_1=$ppp["cell_1"];
$camp=$ppp["camp"];
	$sql3 = "Insert into 1st_term (id,date,sub_name,exame_term,class_name,std_rollno,std_name,father_name,cell_1,pass_mark,total_mark,user_id,sess1,camp,subid) values (null,'$today','$sub_name','$exame_term','$class_name','$rollno','$stdname','$fname','$cell_1','$pass_mark','$total_mark','$userid','$sess1','$camp','$subid')";
mysql_query($sql3) or die("Error : " . mysql_error());
	


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