<?php 
session_start();
include 'dbc.php';
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$userid=$_SESSION["userid"];
$term=$_POST["term"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
$class_name=$_POST["class_name"];
$sub1=$_POST["sub1"];
$sub2=$_POST["sub2"];
$sub3=$_POST["sub3"];
$sub4=$_POST["sub4"];
$sub5=$_POST["sub5"];
$sub6=$_POST["sub6"];
$sub7=$_POST["sub7"];
$sub8=$_POST["sub8"];
$tech1=$_POST['tech1'] ;
$tech2=$_POST['tech2'] ;
$tech3=$_POST['tech3'] ;
$tech4=$_POST['tech4'] ;
$tech5=$_POST['tech5'] ;
$tech6=$_POST['tech6'] ;
$tech7=$_POST['tech7'] ;
$tech8=$_POST['tech8'] ;
$tmark1=$_POST["tmark1"];
$tmark2=$_POST["tmark2"];
$tmark3=$_POST["tmark3"];
$tmark4=$_POST["tmark4"];
$tmark5=$_POST["tmark5"];
$tmark6=$_POST["tmark6"];
$tmark7=$_POST["tmark7"];
$tmark8=$_POST["tmark8"];
$totalmark=$tmark1 + $tmark2 + $tmark3 + $tmark4 + $tmark5 + $tmark6 + $tmark7 + $tmark8;
 $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'];

$sql = "Insert into result (id,date,sess1,term,month_name,class_name,cls_sec,std_rollno,std_name,father_name,cell_1,sub1,sub2,sub3,sub4,sub5,sub6,sub7,sub8,tmark1,tmark2,tmark3,tmark4,tmark5,tmark6,tmark7,tmark8,totalmark,user_id,tech1,tech2,tech3,tech4,tech5,tech6,tech7,tech8) values (null,'$today','$sess1','$term','$month_name','$class_name','$cls_sec','$adm_no','$std_name','$fname','$cell_1','$sub1','$sub2','$sub3','$sub4','$sub5','$sub6','$sub7','$sub8','$tmark1','$tmark2','$tmark3','$tmark4','$tmark5','$tmark6','$tmark7','$tmark8','$totalmark','$userid','$tech1','$tech2','$tech3','$tech4','$tech5','$tech6','$tech7','$tech8')";
$conn->query($sql);
//mysql_query($sql) or die("Error : " . mysql_error());


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

/*$sql="Select * from agents where userid='$user_id'";
$data=mysql_query($sql) or die ("Error:" . mysql_error());
$userdata=mysql_fetch_array($data);
$email=$userdata["e_mail"];
mail($email . ",info@lalburj.com","Candidate Information","Candidate Data Posted Successfully","Passport No:" . $app_pp_no . " of " . $app_name . "Has been Posted Successfully By:" . $_SESSION["userid"]);*/
?>
