<?php
include 'koneksi.php';

if (isset($_POST['id_kurir'])) {
    $id_kurir = $_POST['id_kurir'];
    $jadwal = mysqli_query($koneksi, "SELECT * FROM tbl_jadwal WHERE id_kurir = '$id_kurir'");

    if (mysqli_num_rows($jadwal) > 0) {
        echo '<select name="id_jadwal" class="form-select" required>';
        echo '<option value="">--Pilih Jadwal--</option>';
        while ($row = mysqli_fetch_assoc($jadwal)) {
            echo '<option value="' . $row['id_jadwal'] . '">' . $row['hari'] . ' (' . $row['jam_mulai'] . ' - ' . $row['jam_selesai'] . ')</option>';
        }
        echo '</select>';
    } else {
        echo '<p class="text-danger">Jadwal tidak tersedia.</p>';
    }
}
?>
