<?php 
include ('config.php');
if(!isset($_SESSION['emp_name']))
	 {
	  echo("<script language='javascript'>window.location.href='index.php'</script>");
	  exit;
	 }
	 	if(isset($_REQUEST['submit']))
{
			$emp_name=$_REQUEST['emp_name'];
			$emp_uname=$_REQUEST['emp_uname'];
			$emp_accno=$_REQUEST['emp_accno'];
			$emp_password=$_REQUEST['emp_password'];
			$gender=$_REQUEST['gender'];
			$emp_status='Y';
			$qu1=mysqli_query($conn,"select * from tbl_admin where emp_accno='".$_REQUEST['emp_accno']."'  ");
	$a1=mysqli_num_rows($qu1);
	$f1=mysqli_fetch_assoc($qu1);
	if($a1==0)
	{
			$select=mysqli_query($conn,"insert into tbl_admin (emp_name,emp_uname,emp_accno,emp_password,gender,emp_status) 				                                                                       values('$emp_name','$emp_uname','$emp_accno','$emp_password','$gender','$emp_status')");
echo'<script language=javascript>alert("Record Inserted successfully");</script>';
//header ("location:staffdetails.php");
 echo'<script type="text/javascript">window.location="staffdetails.php";</script>';
			}
			else
			{
				echo '<script language="javascript" type="text/javascript">alert("Account Number  Already Exists");</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=iso-8859-1" />
<link href="css/css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="jq-val/validationEngine.jquery.css" type="text/css"/>
<link rel="stylesheet" type="text/css" href="css/grid.css" tppabs="" media="screen" />
        <!-- Main stylesheet -->
        <link rel="stylesheet" type="text/css" href="css/styles.css" tppabs="" media="screen" />
</head>
<body style="background:none;">
        <?php include('header.php');?>

<table width="1002" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td  class="innertop_bg">
		<form method="post"  name="category" id="category" enctype="multipart/form-data" action="" style="margin: 0 0 0 178px;">
		<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="55"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="100%" height="30" class="heading1">Add Staffs</td>
                  <td width="12%">&nbsp;</td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr class="head_bg">
                  <td width="100%" height="28" colspan="3" class="form_head">Add Staffs </td>
                </tr>
                
                      <tr>
                        <td width="27%" class="form_text">Employee Name</td>
                        <td width="4%" align="center" class="form_text">:</td>
                        <td width="71%" class="form_text"><input name="emp_name" id="emp_name" class="validate[required]" type="text" size="45" />
                        </td>
                      </tr>
                      <tr>
                        <td width="27%" class="form_text">Username</td>
                        <td width="4%" align="center" class="form_text">:</td>
                        <td width="71%" class="form_text"><input name="emp_uname" id="emp_uname" class="validate[required]" type="text" size="45" />
                        </td>
                      </tr>
                     <tr>
                        <td width="27%" class="form_text">Employee Acc.No</td>
                        <td width="4%" align="center" class="form_text">:</td>
                        <td width="71%" class="form_text"><input name="emp_accno" id="emp_accno" class="validate[required]" type="text" size="45" />
                        </td>
                      </tr>
                      <tr>
                        <td width="27%" class="form_text">Password</td>
                        <td width="4%" align="center" class="form_text">:</td>
                        <td width="71%" class="form_text"><input name="emp_password" id="emp_password" class="validate[required]" type="text" size="45" /></td>
                      </tr>
                      
  					<tr>
                        <td width="27%" class="form_text">Gender</td>
                        <td width="4%" align="center" class="form_text">:</td>
                        <td width="71%" class="form_text"><input type="radio" name="gender" value="male"/>Male
                                 <input type="radio" name="gender"  value="female"/>Female</td>
                      </tr>
                      
                      
                  </table>				  
				  </td>
                </tr>
            </table></td>
           </tr>
          <tr>
            <td class="innertop_tablepad1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="69%" align="center"><input name="submit" type="submit"  value="Submit" /></td>
                </tr>
            </table></td>
          </tr>
        </table>
		</form>
		</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>
<link rel="stylesheet" href="jq-val/validationEngine.jquery.css" type="text/css"/>
	<link rel="stylesheet" href="jq-val/template.css" type="text/css"/>
	<script src="jq-val/jquery-1.7.2.min.js" type="text/javascript">
	</script>
	<script src="jq-val/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
	</script>
	<script src="jq-val/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
	</script>
	<script>
		jQuery(document).ready(function(){
			// binds form submission and fields to the validation engine
			jQuery("#category").validationEngine();
		});
		</script>