<!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=utf-8" />
<title>Untitled Document</title>
</head>

<body>


<?php
$id = $_REQUEST['edittrack'];
include('include/conn.php');

$query="SELECT * from trackings where id = '$id'";
$result = mysqli_query($login, $query);


while($rows = mysqli_fetch_array($result)){
    
$id = $rows['id'];
$num = $rows['num'];
$receiveradd = $rows['receiveradd'];
$status = $rows['status'];
$destination = $rows['destination'];
$exptdelvrydate = $rows['exptdelvrydate'];

?>
<?php
if(isset($_REQUEST['updaterack'])){
require_once('include/conn.php');
$id = $_POST['id'];
$num = $_POST['num'];
$receiveradd = $_POST['receiveradd'];
$status = $_POST['status'];
$destination = $_POST['destination'];
$exptdelvrydate = $_POST['exptdelvrydate'];
 

$sql = "UPDATE trackings SET num='$num',receiveradd='$receiveradd',status='$status',destination='$destination',exptdelvrydate='$exptdelvrydate' WHERE id='$id'";

 
 if ($login->query($sql) === TRUE) {
	 
	 echo(" <div class='alert alert-success alert-success' align='center'>
                                <button type='button' class='close' data-sucess='alert' aria-hidden='true'>&times;</button>
                          $num Record Updated successfully <a href='#' class='alert-link'></a>.
                            </div>");
} else {
    echo "Error: " . $sql . "<br>" . $login->error;
}

$login->close();
 
 
}
 
 

	  	
?>

<form id="form1" name="form1" method="post" action="">
  <table width="499" border="0" align="center" cellpadding="5" cellspacing="5">
    <tr>
      <td><input name="id" type="hidden" class="form-control" id="id" value="<?php echo $rows['id']; ?>"/></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td width="244">Tracking Number</td>
      <td width="220"><label for="num"></label>
      <input type="text" name="num" id="num" value="<?php echo $num ?>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td>Receiver's Address</td>
      <td><input type="text" name="receiveradd" id="receiveradd" value="<?php echo $rows['receiveradd']; ?>"/></td>
    </tr>
    <tr>
      <td>Status</td>
      <td><textarea name="status" cols="50" rows="15" id="status"><?php echo $rows['status']; ?></textarea></td>
    </tr>
    <tr>
      <td>Destination</td>
      <td><input type="text" name="destination" id="destination" value="<?php echo $rows['destination']; ?>"/></td>
    </tr>
    <tr>
      <td>Experted Delivery Date</td>
      <td><input type="text" name="exptdelvrydate" id="exptdelvrydate" value="<?php echo $rows['exptdelvrydate']; ?>"/></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="updaterack" id="updaterack" value="Update Tracking" /></td>
    </tr>
  </table>
</form>
<?php
}
	?>
</body>
</html>