What is the correct syntax for using a while loop to populate option tags in a select element in PHP?

When populating option tags in a select element using a while loop in PHP, you need to fetch the data from a database or an array and iterate over it to generate the options dynamically. You can achieve this by using a while loop to iterate over the data and echo out the option tags with the appropriate values.

<select name="example">
<?php
// Assuming $data is an array of options
$i = 0;
while ($i < count($data)) {
    echo '<option value="' . $data[$i] . '">' . $data[$i] . '</option>';
    $i++;
}
?>
</select>