Ouwe rakker |
|
<?php
function buildOption($sValue, $sDisplay, $sCompare = '') {
return '<option value="'.$sValue.'"'.($sValue == $sCompare ? ' selected="selected"' : '').'>'.$sDisplay.'</option>';
}
$aDays = range(1, 31);
$iDefaultDay = 15;
?>
<select name="day" id="day">
<?php
foreach($aDays as $iDay) {
echo buildOption($iDay, $iDay, $iDefaultDay);
}
?>
</select>
<?php function buildOption($sValue, $sDisplay, $sCompare = '') { return '<option value="'.$sValue.'"'.($sValue == $sCompare ? ' selected="selected"' : '').'>'.$sDisplay.'</option>'; } $iDefaultDay = 15; ?> <select name="day" id="day"> <?php foreach($aDays as $iDay) { echo buildOption ($iDay, $iDay, $iDefaultDay); } ?> </select>
|