<?php
require_once('functions.php');
require_once('mysql.php');
$user=$_SESSION['user'];
	$level=$_SESSION['admin_level'];



							if (isset($_GET['id']))
							{
					
						
						$id = $_GET['id'];
						$result = mysqli_query($dbc,("SELECT * FROM labor WHERE lab_id = $id"));
						
						$row = mysqli_fetch_array($result);
						$id=$row["lab_id"];
						$first=$row["first"];
						$last=$row['last'];
						$wage=$row['wage'];
					$di=$row['id_num'];
						mysqli_close($dbc);
						}
								if (isset($_POST['submit'])){
						
						
		
						$first=mysqli_real_escape_string($dbc,($_POST["first"]));
						$last=mysqli_real_escape_string($dbc,($_POST["last"]));
						$wage=mysqli_real_escape_string($dbc,($_POST["wage"]));
									$dii=mysqli_real_escape_string($dbc,($_POST["id_num"]));
						$id = $_POST['id'];
						//$comm=$_POST['comm'];
						$result = mysqli_query($dbc,("update labor set first='$first',id_num='$dii',last='$last',wage='$wage' where lab_id = $id"));
						//$result = mysql_query("update products set category='$name' where category = $catt");
						
					
						mysqli_close($dbc);
						header("location: stff.php");
						}
						?>




<form action="edit_stff.php" method="post">
First Name:<br />
<input name="first" type="text" value="<?php echo $first; ?>" size="50">
<input name="id" type="hidden" value="<?php echo $_GET['id']; ?>" size="50" readonly/>
<input name="catt" type="hidden" value="<?php echo $name; ?>" size="50" readonly/>
<br />
Last Name:<br />
<input name="last" type="text" value="<?php echo $last; ?>" size="50">
Id Number:<br />
<input name="id_num" type="text" value="<?php echo $di; ?>" size="50">

Salary:<br />
<input name="wage" type="text" value="<?php echo $wage; ?>" size="50" >

<input name="id" type="hidden" value="<?php echo $_GET['id']; ?>" size="50" readonly/>
<input name="catt" type="hidden" value="<?php echo $name; ?>" size="50" readonly/>
<br />

<input name="submit" type="submit" value="save">
</form>
