PDA

View Full Version : HTML form dropdown



adityadubey
September 10th, 2005, 10:57 AM
Hi! I am trying to create 3 dropdown menus (day, month and year) for date. I have created one for day and one for month by typing each option, now I want to put the options from 1940 to 2005 in the "year" dropdown. Is there a better or easier way?

Aditya

Ankou
September 10th, 2005, 03:20 PM
Could use JavaScript to output all the options for those years - but it would be better to do that with some server side script. Otherwise... type away.

b.rich
September 10th, 2005, 03:45 PM
You can use almost any language to do this for you but here is an example with php.


<select name="year" size="1">

<?php

for ($i=1940;$i<=2005;$i++){
echo '<option>'.$i.'</option>';
}

?>

</select>

adityadubey
September 12th, 2005, 05:24 AM
thanks! i think this code will be a big help!