在从表中填充的选择框中选择时,在文本框中显示值

Can someone help me with this code?

I'm trying to display the value of a field in a textbox. The value in the textbox should display the shipping address that corresponds to the company name selected from a select box. This select box is populated using a table query and it only displays the company name.

The code goes as...

<form method="POST" action="">
<?php
    try {
        require ("core/database/db.php");
        $stmt = $conn->prepare("SELECT company_name FROM customers ORDER BY company_name");
        $stmt->execute();

        if ($stmt->rowCount() > 0) {

            echo '<select name="company_name" id="company_name" data-placeholder="Type a customer name..." style="width: 400px">';
            echo '<option value=""></option>';

            while ($row = $stmt->fetch(PDO::FETCH_ASSOC))

                echo "'<option value='$row[company_name]'>$row[company_name]</option>";
                echo "</select>";
        }
    }

    catch(PDOException $e) {
        echo 'ERROR: ' . $e->getMessage();
    }

    echo '&nbsp;<input type="reset" id="clearbtn" value="Reset">';
    $ship_address = $row['ship_address']; // <---How can I achieve this goal and where to place it?
    ?>

    <br>
    <input type="text" name="ship_address" value="<?php echo $ship_address; ?>">