<?php
	include("inside/config.php");
	session_start();
	$user=$_SESSION['username'];
	if(empty($user))
	{
		echo "<script>window.location='login.php'</script>";
	}
	$currentpage = "onlineregister";
	$id=$_REQUEST['id'];
	$sql=mysql_query("select * from `online_registration` where `id`='$id'");
	$row=mysql_fetch_array($sql);
	
	if($_REQUEST['action']=="delete")
	{
		$id=$_REQUEST['id'];
		$sqlDel=mysql_query("delete from `online_registration` where `id`='$id'");
		$type = "ok";
		$msg = "Deletion Successful! ";
	}
?>
<!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>Admin Panel : Frontier Public High School</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<?php include('inside/jsfunctions.php'); ?>
</head>
<body>
<?php include('inside/header.php'); ?>
<!-- Container -->
<div id="container">
	<div class="shell">
		
		<!-- Small Nav -->
		<div class="small-nav">
			<a href="#">Dashboard</a>
			<span>&gt;</span>
			Online Student Registration
		</div>
		<!-- End Small Nav -->
		
		<!-- Message OK -->		
		<?php if($type=="ok"){ ?>
        <div class="msg msg-ok" id="msgok">
			<p><strong><?php echo $msg; ?></strong></p>
			<a href="#" class="close" onclick="removeOk()">close</a>
		</div>
		<!-- End Message OK -->		
		<?php } ?>
		<!-- Message Error -->
		<?php if($type=="error"){ ?>
		<div class="msg msg-error" id="error">
			<p><strong><?php echo $msg; ?></strong></p>
			<a href="#" class="close" onclick="removeError()">close</a>
		</div>
        <?php } ?>
		<!-- End Message Error -->
		<br />
		<!-- Main -->
		<div id="main">
			<div class="cl">&nbsp;</div>
			
			<!-- Content -->
			<div id="content" style="margin-left:-10%;">
				
				<!-- Box -->
				<div class="box">
					<!-- Box Head -->
					<div class="box-head" style="width:147%">
						<h2 class="left">Addmission Management</h2>
					</div>
					<!-- End Box Head -->	

					<!-- Table -->
					<div class="table">
					  <table width="150%" border="0" cellspacing="0" cellpadding="0">
					    <tr>
					      <th>Student Name</th>
					      <th>Father Name</th>
					      <th>Gender</th>
					      <th>looking For Admission in Class</th>
					      <th>Contact #</th>
					      <th>More Detail</th>
					      <th width="110" class="ac">Content Control</th>
				        </tr>
					   
<?php
					  		$sql2=mysql_query("select * from `online_registration`");
					  		while($row2=mysql_fetch_array($sql2))
					  		{
					  		?>                        <tr>
  <td class="odd"><h3><?php echo $row2['student_name']; ?></h3></td>
					      <td><?php echo $row2['father_name']; ?></td>
					      <td><?php echo $row2['gender']; ?></td>
					      <td><?php echo $row2['class']; ?></td>
		        <td><?php echo $row2['contact']; ?></td>
                <td><a href="student-detail.php?id=<?php echo $row2['id']; ?>">Full Detail</a></td>
					      <td><a  class="ico del" href="online-registration.php?action=delete&id=<?php echo $row2['id'];?>" onclick="return confirm('Are you sure you want to delete?')">Delete</a>
</td>
				        </tr>
                        <?php
					  		}
					  		?>
				      </table>
						
					</div>
					<!-- Table -->
					
				</div>
				<!-- End Box -->
				

			</div>
			<!-- End Content -->
			
			
		  <div class="cl">&nbsp;</div>			
		</div>
		<!-- Main -->
	</div>
</div>
<!-- End Container -->
<?php include("inside/footer.php"); ?>
</body>
</html>