try {
$con = new PDO("mysql:host=localhost; dbname=dbnameadı","root","");
$con-> exec("SET NAMES utf8mb4; SET CHARSET utf8mb4");
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo 'Bağlanamadı'. $e->getMessage();
}

if (isset($_POST['kargo'])) {
$no = trim(addslashes(htmlspecialchars($_POST['kargo'])));
$query = $con->prepare("SELECT * FROM kargo WHERE takip_no=?");
$query->execute([
$no
]);
if ($query->rowCount()>0) {
$result = $query->fetch(5);
$response = [
'takip_no' => $result->takip_no,
'paket_adet' => $result->paket_adet,
'teslim_tarihi' => $result->teslim_tarihi,
'ad_soyad' => $result->ad_soyad,
'adres' => $result->adres
];
} else {
$response = [
'hata' => 'Kargo Bulunamadı'
];
}
$response = json_encode($response, JSON_UNESCAPED_UNICODE);
echo $response;
exit();
}
?>





content="width=device-width, user-scalable=no, initial-scale=1.0">


Kargo Takip































Takip No Paket Adedi Teslim Tarihi Ad Soyad Adres







<script></script>
<script>
$(function() {
$("#kargo_ara").on("submit", function(e) {
e.preventDefault();
let result;
$.post(window.location, {kargo:$("#takip").val()}, function (response) {
if (!response.hata) {
result = '' +
''+response.takip_no+'' +
''+response.paket_adet+''+
''+response.teslim_tarihi+''+
''+response.ad_soyad+''+
''+response.adres+''+
'';
$("#kargo_ara").hide();
$(".table-responsive").prepend('

Kargo bilgileriniz aşağıdadır

');
} else {
result = 'Kargo Bulunamadı'
}
$("#kargo_sonuc").empty().append(result);
}, 'json')
});

})
</script>