<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>RECEIPT</title>
    <link rel="stylesheet" href="style.css" media="all" />
  </head>
  <body>
  	<?php

$servername = "localhost";
$username = "worldgl1_naija";
$password = "+F0m9v96*wl";
$dbname = "worldgl1_naija";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}
$a=$_POST['trackingshipment'];
$b="";

$sql = "SELECT * from new_record  where tracknumber  LIKE '$a'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {

$b ='';
  // output data of each row
 while($row = mysqli_fetch_assoc($result)) {
	  
	 $b.= '	
           
    <header class="clearfix">
    <br><br>
      <div id="logo">
        <h2 class="name"><strong>WORLD GLOBAL COURIER LOGISTIC</strong></h2>
        <div> 810 E Sahara Ave, Las Vegas, Nevada 89104. USA.</div>
        <div><a href="www.worldglobecourier.com">www.worldglobecourier.com</a></div>
      </div>
      <div id="company">
        <img src="barcode.png">
        <p>'.$row['tracknumber'].'</p>
      </div>
      </div>
    </header>
    <main>
      <div id="details" class="clearfix">
        <div id="client">
          <h2 class="sided"><strong>SHIPPER DETAILS:</strong></h2>
          <p></p>
          <div class="to">Shipper Name: &nbsp;  '.$row['sendername'].'</div>
          <div class="address">Address: &nbsp;  '.$row['senderadd'].'</div>
        </div>
		
        <div id="invoice">
		<br><br>
          <h2 class="sided"><strong>RECEIVER DETAILS:</strong></h2>
          <p></p>
          <div class="to">Shipper Name: &nbsp;  '.$row['receivername'].'</div>
          <div class="address">Address: &nbsp;  '.$row['receiveradd'].'</div>
        </div>
      </div>
	  <h2 class="sided"><strong>PACKAGE DETAILS</strong></h2>
     <br>
      <table border="0" cellspacing="0" cellpadding="0">
        <thead>
          <tr>
            <th>Weight</th>
            <th>Destination</th>
            <th>Pick Up Date</th>
            <th>Delivery Date</th>
            <th>Tracking Number</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>'.$row['weight'].'</td>
            <td>'.$row['destination'].'</td>
            <td>'.$row['datesent'].'&nbsp;'.$row['time_one'].'</td>
			<td>'.$row['deliverydate'].'</td>
            <td>'.$row['tracknumber'].'</td>
          </tr>
        </tbody>
   
      </table>
	  ' ;
		 
					}
	}
else{
	$b=$_POST['trackingshipment'].' (Not found) <a href="receipt.html">Please try again</a>.';	
}
echo $b;
		

mysqli_close($conn);
?>      
<a href="javascript:window.print()" class="butt">Print Airway Bill</a>
      
    </main>

  </body>
</html>