Recent Posts
Recent Comments
<div id="main-content" class="container">
<div style="margin-top:3%;">
<form action="/tracking">
<div class="form-group">
<input type="text" class="form-control" name="awbno" placeholder="Please enter the tracking number.">
</div>
<button type="submit" class="btn btn-primary">Track</button>
</form>
</div>
<?php
$isfound = 0;
$t_num=0;
$t_num = isset($_GET["awbno"]) ? $_GET["awbno"] : 0;
if ($t_num == 0) {
echo "Please Enter Your Tracking Number";
get_footer();
return false;
} else {
// Connect to the database using PDO (more secure).
$dsn = "mysql:host=usersoft.tech;dbname=nadeemur_globalexpress";
$username = "nadeemur_global_express";
$password = "GlobalExpress2023";
try {
$conn = new PDO($dsn, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$strsql = "SELECT * FROM tblawb WHERE fldawb = :t_num LIMIT 1";
$stmt = $conn->prepare($strsql);
$stmt->bindParam(':t_num', $t_num, PDO::PARAM_STR);
$stmt->execute();
$fetch = $stmt->fetch(PDO::FETCH_ASSOC);
if ($fetch) {
// Output shipment details.
$displaydate = date('d-m-Y', strtotime($fetch['fldDate']));
$consignee = $fetch['fldConName'];
$fldShipName = $fetch['fldShipName'];
$fldService = $fetch['fldService'];
$fldStatus = empty($fetch['fldStatus']) ? "IN Process" : $fetch['fldStatus'];
$fldPCS = $fetch['fldPCS'];
$fldWt = $fetch['fldPartyWt'];
$fldOriginName = $fetch['fldOrigin'];
$fldDestName = $fetch['fldConCity'];
echo '<h1 style="margin-top:5px;">Shipment Details</h1>';
echo '<div>
<table class="table table-striped">
<tbody>
<tr>
<th>Booking Date</th>
<th>Consignee Name</th>
<th>Shipper</th>
<th>Service Type</th>
<th>CN Status</th>
<th>Pieces</th>
<th>Weight</th>
<th>Origin</th>
<th>Destination</th>
</tr>
<tr>
<td data-th="Booking Date">' . $displaydate . '</td>
<td data-th="Consignee Name">' . $consignee . '</td>
<td data-th="Shipper">' . $fldShipName . '</td>
<td data-th="Service Type">' . $fldService . '</td>
<td data-th="CN Status">' . $fldStatus . '</td>
<td data-th="Pieces">' . $fldPCS . '</td>
<td data-th="Weight">' . $fldWt . '</td>
<td data-th="Origin">' . $fldOriginName . '</td>
<td data-th="Destination">' . $fldDestName . '</td>
</tr>
</tbody>
</table>
</div>';
} else {
// Handle when no results are found in tblawb.
// You can add some error handling here.
}
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
}
?>
<div class="table-responsive">
<table class="table table-striped" style='background-color: white; margin: auto; margin-top: 5px; margin-bottom: 10px;'>
<thead>
<tr>
<th>Tracking Number</th>
<th>Location</th>
<th>Date & Time</th>
<th>Status</th>
</tr>
</thead>
<?php
$qry = "SELECT awBillNo, HistDate, Location, Remarks FROM history WHERE awBillNo = :t_num ORDER BY HistDate DESC";
$stmt = $conn->prepare($qry);
$stmt->bindParam(':t_num', $t_num, PDO::PARAM_STR);
$stmt->execute();
$num = $stmt->rowCount();
if ($num >= 1) {
$isfound = 1;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$t_num = $row['awBillNo'];
$Location = $row['Location'];
$date = date_create($row['HistDate']);
$status = $row['Remarks'];
echo "<tr>";
echo "<td>" . $t_num . "</td>";
echo "<td>" . $Location . "</td>";
echo "<td>" . date_format($date, "d-M-Y H:i:s") . "</td>";
echo "<td>" . $status . "</td>";
echo "</tr>";
}
} else {
// Handle when no results are found in history.
// You can add some error handling here.
}
?>
</table>
</div>
</div>