Simple PHP Question

LPL

LPL

Permabanned
Joined
20 Jul 2008
Posts
439
PHP:
<select class="input" name="day">
  <?php
    $day = 1;
    while ($day <= 31) {
    echo "<option value=" . $day . ">" . $day . "</option>";
    $day = $day + 1;
    }
  ?>
</select>

How do I set a default value for the option?
ie when the page loads it doesn't start at 1 but whatever number I set.

I tried option selected or value selected and both just set the default displayed number to 31
 
I want the counter to go from 1-31 and then have the default value of something from a database.

I tried the above last night and still it defaults to 31
 
Back
Top Bottom