<?php
	include("inside/config.php");
	session_start();
	$user=$_SESSION['username'];
	if(empty($user))
	{
		echo "<script>window.location='login.php'</script>";
	}
	$id=$_REQUEST['id'];
	$sql=mysql_query("select * from `main_area` where `m_id`='$id'");
	$rs=mysql_fetch_array($sql);
if($_REQUEST['action']=="update")
	{
		$id = $_REQUEST['id'];
		$mcode = $_REQUEST['m_code'];
		$mname = $_REQUEST['m_name'];
	//Run Update Query
		$update =mysql_query("update `main_area` set `m_code`='$mcode', `m_name`='$mname' where `m_id`='$id'") or die(mysql_error());
		if(!$update){
		$type = "error";	
		$msg = "Error in Updating Fee";
		}
		else {
			echo "<script>alert('Updation Successful!');window.location='fee-structure.php'</script>";
		}		
					
}
?>
<!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>
			Fee Structure</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">
				
				<!-- Box --><!-- End Box -->
				
				<!-- Box -->
				<div class="box">
				  <!-- Box Head -->
				  <div class="box-head">
				    <h2 class="left">Edit Monthly Feel</h2>
				  </div>
				  <!-- End Box Head -->
				  <form action="?action=update&id=<?php echo $id; ?>" method="post" enctype="multipart/form-data">
				    <table width="99%" border="0">
				      <tr>
				        <td width="11%" valign="middle">Code
			            <label></label></td>
				        <td width="89%" valign="middle">Fee :
			            <input name="fee_b" type="text" required="required" id="fee_b" value="<?php echo $rs['Fee_b'];?> " size="18" /></td>
			          </tr>
				      <tr>
				        <td valign="middle">Name</td>
				        <td valign="middle">Fee :
				          <input name="fee_g" type="text" required="required" id="fee_g" value="<?php echo $rs['Fee_g'];?> " size="18" /></td>
			          </tr>
			        </table>
				    <!-- Form Buttons -->
				    <div class="buttons">
				      <input type="reset" class="button" value="reset" />
				      <input type="submit" class="button" value="submit" />
			        </div>
				    <!-- End Form Buttons -->
			      </form>
			  </div>
				<!-- End Box -->

			</div>
			<!-- End Content -->
			
			<!-- Sidebar -->
			<div id="sidebar">
				
				<!-- Box -->
			  <div class="box">
					
					<!-- Box Head -->
					<div class="box-head">
						<h2>Management</h2>
					</div>
					<!-- End Box Head-->
					
					<div class="box-content">
				</div>
				</div>
				<!-- End Box -->
			</div>
			<!-- End Sidebar -->
			
			<div class="cl">&nbsp;</div>			
		</div>
		<!-- Main -->
	</div>
</div>
<!-- End Container -->
<?php include("inside/footer.php"); ?>
</body>
</html>