<?php
<?php
$host = "localhost";
$user = "odmr9632_userdb";
$pass = "@Sukabumi2018";
$db   = "odmr9632_order_db";

$conn = new mysqli($host, $user, $pass, $db);
if ($conn->connect_error) {
  die("Koneksi gagal: " . $conn->connect_error);
}
?>
$jenis = $_GET['jenis'];

$table = $jenis === "Fisik" ? "produk_fisik" : "produk_digital";
$result = $conn->query("SELECT nama_produk FROM $table");

$data = [];
while ($row = $result->fetch_assoc()) {
  $data[] = $row['nama_produk'];
}
echo json_encode($data);
?>
