What are best practices for displaying and updating dropdown selections in PHP based on data from multiple database tables?

When displaying dropdown selections in PHP based on data from multiple database tables, it is best practice to first fetch the necessary data from the tables and then populate the dropdown options accordingly. This can be achieved by using SQL queries to retrieve the data and then looping through the results to create the dropdown options.

<?php
// Assume $connection is the database connection object

// Fetch data from multiple tables
$query1 = "SELECT id, name FROM table1";
$result1 = mysqli_query($connection, $query1);

$query2 = "SELECT id, description FROM table2";
$result2 = mysqli_query($connection, $query2);

// Populate dropdown options
echo '<select name="dropdown">';
while ($row = mysqli_fetch_assoc($result1)) {
    echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}

while ($row = mysqli_fetch_assoc($result2)) {
    echo '<option value="' . $row['id'] . '">' . $row['description'] . '</option>';
}
echo '</select>';
?>