<?php include("includes/config.php"); 
		$student_name = $_REQUEST['name'];
		$father_name = $_REQUEST['fname'];
		$guardian_name = $_REQUEST['gname'];
		$nationality = $_REQUEST['nationality'];
		$gender = $_REQUEST['gender'];
		$dob = $_REQUEST['DD']."/".$_REQUEST['MM']."/".$_REQUEST['YY'];
		$class = $_REQUEST['class'];
		$xschool = $_REQUEST['xschool'];
		$guardian_cnic = $_REQUEST['cnic'];
		$guardian_occupation = $_REQUEST['occoupation'];
		$email = $_REQUEST['email'];
		$contact = $_REQUEST['contact'];
		//Writes the information to the database
   		$insert = mysql_query("insert into `online_registration`(`student_name`, `father_name`, `guardian_name`, `nationality`,`gender`,`dob`,`class`,`xschool`,`guardian_cnic`,`guardian_occupation`,`email`,`contact`)
									values('$student_name','$father_name','$guardian_name','$nationality','$gender','$dob','$class','$xschool','$guardian_cnic','$guardian_occupation','$email','$contact')");

//sender address
$to = "faizmuhammadkhan2@gmail.com";
// the message
$message = "A new student $student_name has been registered online check admin panel for detail \n Frontier Public High School Website";

// use wordwrap() if lines are longer than 70 characters
$message = wordwrap($message,70);
$headers = "From: no-reply@frontierpublichighschoo.com";
// send email
if(@mail("$to","Online Student Registration",$message,$headers)){
	echo "Mail Sent Successfully";
}
else{
	echo "Mail Not Sent";
	}
									
									
if(!$insert){
	die('Invalid query: ' . mysql_error());
	}
	else {
		$msg="Thanks For Online Registration Your Application Form Has been Submitted Successfully, We Will Contact You Soon!";
	}
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Frontier Public High School</title>
<link rel="stylesheet" type="text/css" href="styles/my.css"  />
</head>

<body>
<!-- Wrapper Starts Here -->
<div id="wrapper">
<?php 
include("includes/header.php");
//include("includes/slideshow.php");
?>
<!-- Contents Starts -->
<div class="content"><h3><?php echo $msg; ?></h3>
</div>
<!-- Contents Ends -->
<?php
include("includes/sidebar.php");
include("includes/footer.php");
?>
</div>
<!-- Wrapper Ends -->
</body>
</html>
