The function of this web application is to: select a customer from the dropdown list (the dropdown list values are auto popup from the database), it will print the selected customer name and its postcode on the result page.
When I choose the customer name from the dropdown list and click the submit button, the result page only prints the $customerv value (the 1st echo), but the $result value (2nd echo) was not printed. The customer name is unique in the database.
index.php:
<?php
require_once('config.php');
?>
<!DOCTYPE HTML>
<html>
<form action="result.php" method="post">
Customer:<br>
    <select Customer id="customer" name="Customer">
      <option value="">--- Select Customer ---</option>
      <?php
      $sql = "SELECT b.BPName from BP b  where b.BPCode  like 'C%' Order by b.BPName";
      $customer = mysqli_query($conn, $sql);
      while ($cat = mysqli_fetch_array(
        $customer,
        MYSQLI_ASSOC
      )) :;
      ?>
        <option value="<?php echo $cat['BPName']; ?>">
          <?php echo $cat['BPName']; ?>
        </option>
      <?php
      endwhile;
      ?>
    </select>
<input type="submit" value="Submit">
  </form>
</html>
config.php:
<?php
$servername = "localhost";
$username = "xxx";
$password = "xxx";
$databse = "xxx";
$conn = new mysqli($servername, $username, $password, $databse);
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
?>
result.php:
<table>
<?php 
require_once('config.php');
    $customerv = $_POST['Customer'];
    echo $customerv;
    $sql = "SELECT shiptozipcode FROM BP WHERE BPName ='$customerv'";
    $result = $conn->query($sql);
    echo $result;
?>
</table>
 
    