<?php 
include ('config.php');
if(!isset($_SESSION['emp_name']))
	 {
	  echo("<script language='javascript'>window.location.href='index.php'</script>");
	  exit;
	 }
$sno=base64_decode($_REQUEST['id']);
$select=mysqli_query($conn,"select * from tbl_admin where sno='".$sno."'") or die(mysql_error());
$res=mysqli_fetch_array($select);
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'];
$update=mysqli_query($conn,"update tbl_admin set emp_name='$emp_name',emp_uname='$emp_uname',emp_accno='$emp_accno',emp_password='$emp_password',gender='$gender'  where sno='".$sno."'") or die(mysql_error());

echo'<script language=javascript>alert("Record Updated successfully");</script>';
 echo'<script type="text/javascript">window.location="staffdetails.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=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" />
<body>  
        <?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_tablepad"></td>
      </tr>
      <tr>
        <td class="innertop_bg">
		<form method="post" name="subcategory" id="subcategory" action="" onsubmit="return val();"  enctype="multipart/form-data" 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="88%" height="30" class="heading2">Edit Staffs</td>
                  <td width="12%"><table width="70%" border="0" align="right" cellpadding="0" cellspacing="0">
                      <tr>
                      </tr>
                  </table></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">Edit Staffs </td>
                </tr>
                <tr>
                  <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  
                      <tr>
                        <td width="27%" class="form_text">Employee Name</td>
                        <td width="3%" align="center" class="form_text">:</td>
                        <td width="70%" class="form_text"><input name="emp_name" id="emp_name" class="validate[required]" value="<?php echo $res['emp_name']; ?>" type="text" size="45" />
                        <input type="hidden" name="sno" id="sno" value="<?php echo $res['sno'];?>"></td>
                      </tr>
                       <tr>
                        <td width="27%" class="form_text">User Name</td>
                        <td width="3%" align="center" class="form_text">:</td>
                        <td width="70%" class="form_text"><input name="emp_uname" id="emp_uname" class="validate[required]" value="<?php echo $res['emp_uname']; ?>" type="text" size="45" /></td>
                      </tr>
                      <tr>
                        <td width="27%" class="form_text">Employee Acc.No</td>
                        <td width="3%" align="center" class="form_text">:</td>
                        <td width="70%" class="form_text">
                        <input name="emp_accno" id="emp_accno" class="validate[required]" type="text" size="45" value="<?php echo $res['emp_accno']?>"/>
                       </td>
                      </tr>
                      <tr>
                        <td width="27%" class="form_text">Password</td>
                        <td width="3%" align="center" class="form_text">:</td>
                        <td width="70%" class="form_text"><input name="emp_password" id="emp_password" class="validate[required]" value="<?php echo $res['emp_password']; ?>" type="text" size="45" /></td>
                      </tr>
                              <tr>
                        <td width="27%" class="form_text">Gender</td>
                        <td width="3%" align="center" class="form_text">:</td>
                        <td width="70%" class="form_text"><input name="gender" id="gender" class="validate[required]" value="male"<?php if($res['gender']=="male"){?> checked="checked"<?php }?> type="radio" size="45" />Male
                        <input name="gender" id="gender" class="validate[required]" value="female"<?php if($res['gender']=="female"){?> checked="checked"<?php }?> type="radio" size="45" />Female</td>
                      </tr>
                              </table>
                                
                                 
				  </td>
                </tr>
          

                 </table>      
            </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> 
		</table>
		</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
</table>
</body>