Re: populate a list menu
| From: | Jean-Christian Imbeault | Date: | Tue, 07 Jan 2003 06:02:36 +0000 |
| Subject: | Re: populate a list menu | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130531@lists.php.net to get a copy of this message | ||
Bruce Levick wrote:
I am looking to populate a list menu with the current date and then the 30days after that current date. Is there a small snippet of code that achieves this??Hvae a look at date(), mktime() in the manual. Here something that should help you get started, it is untested. function day_dropdown() { ?> <select name="date"> <?php for ($i=0;$i<30;$i++) {
$timestamp = mktime(0,0,0,date("m") ,date("d")+$i,date("Y"));
$date = date("Ydm", $timestamp);
?>
<option value="<?php echo *some value* ?>"><?php echo $date; ?></option>
<?php
}
?>
</select>
<?php
}
?>
Jc