Anda di halaman 1dari 3

<?

PHP
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: ../../kms/login.php");
}
include('./includes/config.php');
$employee = $_POST['employ'];
if (isset($_POST['update'])){
$new = $_POST['Employee'];
$Lname = $_POST['Lname'];
$Fname = $_POST['Fname'];
$Unit = $_POST['unit'];
$Position = $_POST['Position'];
$visor = $_POST['SupervisorID'];
$Acc = $_POST['AccessLevel'];
$query="UPDATE empinfo Set empID='$new', lastname='$Lname', firstname='$Fname',
Unit='$Unit', Position='$Position', Supervisor='$visor' where empID = '$employee
'";
$query2 ="UPDATE empaccount SET empID='$new', lastname='$Lname', AccessLevel='$A
cc' where empID = '$employee'";
if (!mysql_query($query,$db))
{
die('Error: ' . mysql_error());
}
if (!mysql_query($query2,$db))
{
die('Error: ' . mysql_error());
}
mysql_close($db);
header("Location:empmngt.php");
/*echo"$new";
echo"$Lname";
echo"$Fname";
echo"$Unit";
echo"$Position";
echo"$visor";
echo"$Acc";*/
}

?>

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./includes/style.css">
<title></title>
</head>
<body>
<div class="header">
<img src="../images/logo.png">
<b>
<ul>
<li><a href="home.php">Dashboard</a></li>
<li><a href="createevent.php">Create Event</a></li>
<li><a href="reports.php">Reports</a></li>
<li><a href="recommendations.php">Recommendations</a></li>
<li><a href="empmngt.php" class="active">Employee Mngmt.</a></li>
<li><a href="changepwsd.php">Password</a></li>
<li><a href="logout.php">Log-out</a></li>
</ul>
</b>
<br>
</div>
<div class="contains">
<?php
$query = "SELECT empid, lastname, firstname, unit, position, supervisor from emp
info where empid='$employee'";
$result = @mysql_query($query);
$results = array();
$results= mysql_fetch_assoc($result, MYSQL_NUM);
$employee = $results[0];
$Lname = $results[1];
$Fname = $results[2];
$Unit = $results[3];
$Position = $results[4];
$visor = $results[5];
$querylev = "SELECT AccessLevel from empaccount where empID ='$employee'";
$resultlev = @mysql_query($querylev);
$resultarraylev = array();
$resultarraylev = mysql_fetch_assoc($resultlev, MYSQL_NUM);
$level = $resultarraylev[0];
$querysup = "SELECT FirstName, LastName from empinfo where empID ='$visor'";
$resultsup = @mysql_query($querysup);
$resultarraysup = array();
$resultarraysup = mysql_fetch_assoc($resultsup, MYSQL_NUM);
$Fsup = $resultarraysup[0];
$Lsup = $resultarraysup[1];

echo ' <br>


<center>
<h2>Employee Management</h2>
<form action="" method="POST">
<center><h3>Edit Details</h3>
</center>
<center><table align="center">
<tr>
<td height="40" width="120"><font color="black">Employee ID:</fo
nt></td>
<td height="30" width="600"><input type="text" required name="Em
ployee" size="20" placeholder="Employee ID" value="'.$employee.'"></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">Last Name:</font
></td>
<td height="30" width="600"><input type="text" required name="Ln
ame" id="Lname" size="20" placeholder="Last Name" value="'.$Lname.'"></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">First Name:</fon
t></td>
<td height="30" width="600"><input type="text" required name="Fn
ame" id="Fname" size="20" placeholder="First Name" value="'.$Fname.'"></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">Unit:</font></td
>
<td height="30" width="600"><input type="text" required name="un
it" id="unit" size="20" placeholder="Unit"value="'.$Unit.'"></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">Position:</font>
</td>
<td height="30" width="600"><input type="text" name="Position" s
ize="20" id="Position" placeholder="Position"value='.$Position.'></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">Supervisor ID:</
font></td>
<td height="30" width="600"><input type="text" required name="Su
pervisorID" id="SupervisorID" size="20" placeholder="Employee ID of Superior"val
ue='.$visor.'> <font size="2"> ('.$Lsup.', '.$Fsup.')</font></td>
</tr>
<tr>
<td height="40" width="120"><font color="black">Access Level:</f
ont></td>
<td height="40" width="600"><input type="text" name="AccessLevel
" size="20" id="AccessLevel" placeholder="Unit Head/Chairperson/Faculty" value='
.$level.'></td>
</tr>
<tr><td><input class="button" name="update" type="submit" value ="Confir
m"></td></tr>
</table>
</center>
</form>
<br>
<hr>
<form action="empmngt.php">
<center><input type="submit" class="button" value="Back"></center>
</form>
<br><br>
';
?>

Anda mungkin juga menyukai