...

View Full Version : Date Drop Down Menu?



ping182nz
06-16-2005, 04:39 AM
Hi,

I am looking for some code that will list the Day, month, year in seperate drop down menus, I want the day menu to limit the day depending on the month, For example some months have 31 days some have 28 and some have 30??

Any Ideas?

Thanks,

Matt

delinear
06-16-2005, 09:18 AM
You mean you want one drop down box for days, one for months and one for years and you want the days options to dynamically change depending what the user selects in the months box? If so, you'd be better off getting the data from PHP but then writing the actual script in javascript, since PHP won't be able to change the number of days in the days drop down menu without a page refresh.

Getting the actual data is easy with PHP, using the many options available with the date() function. For instance, date("t", mktime (0,0,0,$month,1,$year)); will tell you exactly how many days there are in the month "$month" during the year "$year". You just need to output the data as arrays or something that your javascript can use to create the dynamic drop-downs.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum