<?php 
session_start();
include 'dbc.php';
$userid=$_SESSION["userid"];
$remarks=$_POST["remarks"];
$bname=$_POST["bname"];
$accno=$_POST["accno"];
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
		 $sql2 = "SELECT * FROM admission where std_rollno = '$bname' and  user_id='$userid'";
$result2=$conn->query($sql2);
$row2 = $result2->fetch_assoc();
$std_name=$row2['std_name'] ;
$fname=$row2['fname'] ;
$class_name=$row2['class_name'] ;

$sql = "Insert into studentcomplain (id,notice,bname,accno,status,user_id,date,std_name,fname,class_name) values (null,'$remarks','$bname','$accno','Open','$userid','$today','$std_name','$fname','$class_name')";
$conn->query($sql);
//mysql_query($sql) or die("Error : " . mysql_error());



header("location:Student_Teacher_Complain.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"]);*/
?>
