<?php
// get_customers.php

// Assuming you have a database connection established already
include 'connect.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  $selectedExecutive = $_POST['executive'];

  $query = "SELECT * FROM customer WHERE executive = '$selectedExecutive' ORDER BY ID ASC";
  $result = mysqli_query($conn, $query);

  $options = '';
  while ($row = mysqli_fetch_assoc($result)) {
    $options .= "<option value='" . $row['ID'] . "'>" . $row['name'] . "</option>";
  }

  echo $options;
}
?>
