To sort the dropdown search result by customer_name, you can modify the SQL query to include an ORDER BY clause that sorts the records by customer_name. Replace the following line:
$records = mysqli_query($conn, "SELECT * From customer_list ORDER BY customer_name ASC");
with:
$records = mysqli_query($conn, "SELECT * FROM customer_list ORDER BY customer_name");
To show only the customer_name in the dropdown search result, you can modify the option tag to display only the customer_name. Replace the following line:
echo "<option value='". $data['customer_id'] ."'>" .$data['customer_code']. " - " . $data['customer_name']."</option>";
with:
echo "<option value='". $data['customer_id'] ."'>" . $data['customer_name']."</option>";
With these modifications, the dropdown search result will show only the customer_name and will be sorted by customer_name.