You are here: Re: Dropdown box to display variable values « HTML « IT news, forums, messages
Re: Dropdown box to display variable values

Posted by Jonathan N. Little on 01/10/07 02:25

fun2trash@gmail.com wrote:
> 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>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация