What potential issue can arise when setting a default selected option in a dropdown list using PHP?

When setting a default selected option in a dropdown list using PHP, a potential issue that can arise is if the value you are trying to set as the default does not exist in the dropdown list options. This can result in the dropdown displaying a blank or incorrect default value. To solve this issue, you should ensure that the default value you are setting is actually present in the dropdown options.

<select name="dropdown">
    <option value="option1" <?php echo ($selectedOption == 'option1') ? 'selected' : ''; ?>>Option 1</option>
    <option value="option2" <?php echo ($selectedOption == 'option2') ? 'selected' : ''; ?>>Option 2</option>
    <option value="option3" <?php echo ($selectedOption == 'option3') ? 'selected' : ''; ?>>Option 3</option>
</select>