|
Posted by J.O. Aho on 11/18/06 22:22
linda wrote:
> "linda" <n0spamF0rme@tiscali.co.uk> wrote in message
> news:455f77d1_2@mk-nntp-2.news.uk.tiscali.com...
>> "MS" <MS@nospam.com> wrote in message
>> news:X6SdnSEfJNJKxcLYnZ2dnUVZ8tKdnZ2d@bt.com...
>>>> for ($year=2006; $year>=1945; $year--) {
>>>>
>>> The above will work fine as you have found, but if you hard code the
>>> Years
>>> then next year, and subsequent years, you will need to change your code
>>> to
>>> allow for year 2007, 2008 etc...
>>>
>>> You may find this helpful
>>>
>>> for ($year=date('Y'); $year>=(date('Y')-100); $year--) {
>>>
>>> this will list the previous 100 years !!
>>>
>>> MS
>>> ----
>>> Join MyClubWeb.co.uk - The Home of Club Websites and Medium to Small
>>> Businesses.
>>>
>>>
>> Hi MS,
>>
>> You must have been looking over my sholder lol... i did this very same
>> thing this after noon like this:
>>
>> //Make the years
>> $thisyear = date('Y');
>>
>> echo '<select name="year">';
>> for ($year=$thisyear; $year>=1945; $year--) {
>> echo "<option value=\"$year\">$year</option>\n";
>> }
>> echo '</select>';
>>
>> Will you please stay out of my bedroom ;-)
>
> Your hundred year difference is a good idea though, and it's a lot more
> compact, so thank you I've altered my code to the way you have shown thank
> you.
There are a few who has passed 100 years of age, even if the likelihood of
someone who is passed to visit your site will be small, but if you increase to
125, then you should be more or less safe.
//Aho
[Back to original message]
|