<?php
session_start();
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: index.php");
} 
 //include 'logoff.html';
?>
<?php
if(isset($_POST['submit'])){
$pname=$_POST['IDNumber'];	

$link = mysqli_connect("localhost", "comeadve_glory1", "Safari#@2027$", "comeadve_tdmc");

    if($link === false){

        die("ERROR: Could not connect. " . mysqli_connect_error());

}
$order1 = "SELECT * FROM toiletboy WHERE IDNumber='$pname'";	

$result1=mysqli_query($link,$order1);	
  
if(mysqli_num_rows($result1)== 0){
	
	$msg="Sorry,  Try again";
}
else{
    $row = mysqli_fetch_array($result1); 
	//var_dump( $row);
}

mysqli_close($link);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PMS Member's Only</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet" type="text/css" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<!--[if IE 6]>
<link href="default_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script type="text/javascript">

</script>
</head>
<body>
<div id="header" class="container">
	<div id="logo">
		<h1><a href="#">PMS - Porter's Management System</a></h1>
	</div>
</div>

<div id="page" class="container">
	<div id="sidebar1">
		<div id="box1">
				<ul class="style1">
				<li class="first"><a href="select.php" class="link-style">SELECT PORTERS</a></li>
				<li><a href="addporters.php" class="link-style">ADD RECORDS</a></li>
                <li><a href="editall.php" class="link-style">Edit RECORDS</a></li>
				<li><a href="deleteporter.php" class="link-style">DELETE PORTER</a></li>
				<li><a href="#" class="link-style">UPDATE STATUS</a></li>
                               <li><a href="logout.php" class="link-style">Logout</a></li>
			</ul>
            </div>
	</div>
	<div id="content" align="center"><br />
<div class="specialselection">
<h4> Edit Toilet Boy records</h4>
<form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>" target="_self" onsubmit="return checkForm(this);">
<div class="editrow"><div class="edleft">Enter Acc.Number:</div><div class="edright"> <input name="IDNumber" type="text" size="24" value="<? print $row["IDNumber"] ?>"/>   
  :    
    <input name="submit" type="submit"  value="  Edit  "/></div></div>
</form>
<form action="changetoiletboy.php" method="POST" name="form1" target="_self">
<div class="msg"><?php $msg = $_GET['msg'];  //GET the message
			if($msg!='') echo '<p>'.$msg.'</p>';?></div>
<div class="editrow"><div class="edleft">Account Number: </div><div class="edright"><input name="IDNumber" type="text" id="IDNumber" size="35" maxlength="100" value="<? print $row["IDNumber"] ?>" /></div></div>
<div class="editrow"><div class="edleft">Full Name:</div><div class="edright"> <input name="Name" type="text" id="Name" size="35" maxlength="200" value="<? print $row["Name"] ?>"/></div></div>
<div class="editrow"><div class="edleft">Phone Number:</div><div class="edright"> <input name="Phone" type="text" id="Phone" size="35" maxlength="100" value="<? print $row["Phone"] ?>" /></div></div>
<div class="editrow"><div class="edleft">ID: </div><div class="edright"><input name="Id" type="text" id="Id" value="<? print $row["Id"] ?>" size="35" maxlength="200" readonly="readonly"/></div></div>
<div class="editrow"><div class="edright"><input type="submit" name="button2" id="button2" value="  Save Records  " /></div></div>
</form>

</div><br />
	</div>
		
</div>
<div id="footer">
	<p>&copy; Private Kilimanjaro. All rights reserved. Design by <a href="#">Pamoja Web Solutions</a></p>
</div>
</body>
</html>
