Dropdown box to display variable values

F

fun2trash

Hi,

I would like to be able to display the actual values of a variables (or
in other words, populate) the options for the drop down box.

For example: I would like to define a variable yesterday and today.
Then, I would like to display the yesterday's date and today's date on
the dropdown box. Of course, by tomorrow, the options should change.
Is this possible?

To clarify further, today would be 1-9-2007 and yesterday would be
1-8-2007. So, I would like a dropdown box that displays those dates
today. However, by tomorrow, the dropdown box should display 1-9-2007
for yesterday and then 1-10-2007 for today.

I would really appreciate any kind of help.
Thanks.
 
J

Jonathan N. Little

Hi,

I would like to be able to display the actual values of a variables (or
in other words, populate) the options for the drop down box.

For example: I would like to define a variable yesterday and today.
Then, I would like to display the yesterday's date and today's date on
the dropdown box. Of course, by tomorrow, the options should change.
Is this possible?

To clarify further, today would be 1-9-2007 and yesterday would be
1-8-2007. So, I would like a dropdown box that displays those dates
today. However, by tomorrow, the dropdown box should display 1-9-2007
for yesterday and then 1-10-2007 for today.

Need scripting. Here is a PHP solution

<select name="appointment">
<?php
$numberOfDay=10; //set as required
for($i=0; $i<$numberOfDay; $i++){
$theDate=date('m-d-Y', strtotime("+$i Days"));
echo "<option value=\"$theDate\">$theDate</option>";
}
?>
</select>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top