What is the best method to automatically fill dropdown menus with the current date in PHP?

To automatically fill dropdown menus with the current date in PHP, you can use the date() function to get the current date and then loop through the days, months, and years to populate the dropdown menus accordingly.

<select name="day">
    <?php
    for ($i = 1; $i <= 31; $i++) {
        echo "<option value='$i'>$i</option>";
    }
    ?>
</select>

<select name="month">
    <?php
    for ($i = 1; $i <= 12; $i++) {
        echo "<option value='$i'>$i</option>";
    }
    ?>
</select>

<select name="year">
    <?php
    $currentYear = date("Y");
    for ($i = $currentYear; $i >= $currentYear - 100; $i--) {
        echo "<option value='$i'>$i</option>";
    }
    ?>
</select>