Hello all.
I’m developing a site, in which there is a field named “Date of Birth.”
I want to automate that field with select options and and within a predefined range of years. but I’m unable to put the logic in the correct order.
please help me ?
- Output a select HTML tag
- Loop through years, outputting an option tag each loop
- Output the ending HTML select tag
Or, if you want the full code and because I’m feeling extra generous
echo '<select name="Year">';
for($Year = 1901; $Year <= 1992; $Year++){
printf('<option value="%1$s">%1$s</option>', $Year);
}
echo '</select>';
Thanx Jake
Actually I was thinking the other way, means in the php’s date function way, and i.e. where I was struck…
Thanx for the help. Now I can automate the other two fields too, of month and day.
Yo!!
Logic was simple but I was thinking the other way… lol…