Date of birth form

Hey guys, i’ve been looking on the forums and googleing for a php script that loops through years, months and days for options in a select input i.e.



<select name="year">
<option value="1910">1910</option>
<option value="1911">1911</option>
<option value="1912">1912</option>
<option value="1913">1913</option>
<!--to current year-->
<option value="2008">2008</option>
</select>

<select name="month">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<!--etc...-->
</select>

<select name="days">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<!--etc...-->
</select>


I’m sure there is while or for loop that does this…just to save time lol. any info would be great. thanks guys

Hey Simplistik, those functions are great, thanx…but cud you tell me how to print the form on the webpage. I tried the following, but nothing appeared on the browser. :crying:


<?php function yearOptions(); ?>
<?php function dayOptions() ; ?>
<?php function dayOptions(); ?>


<?php echo yearOptions(); ?>
<?php echo dayOptions() ; ?>
<?php echo dayOptions(); ?>

Please help. Thanks much!

[QUOTE=chokra;2348101]Hey Simplistik, those functions are great, thanx…but cud you tell me how to print the form on the webpage. I tried the following, but nothing appeared on the browser. :crying:


<?php function yearOptions(); ?>
<?php function dayOptions() ; ?>
<?php function dayOptions(); ?>


<?php echo yearOptions(); ?>
<?php echo dayOptions() ; ?>
<?php echo dayOptions(); ?>

Please help. Thanks much![/QUOTE]

You’ll only use the function keyword when declaring a function, and the echo is contained within the function itself. So, you can just do this:


<?php yearOptions(); ?>
<?php monthOptions(); ?>
<?php dayOptions(); ?>

think it would actually be
<html>
<select name=“year”>
[COLOR=#000000][FONT=Courier New][COLOR=#0000bb]<?php yearOptions[/COLOR]COLOR=#007700; [/COLOR][/FONT][COLOR=#0000bb][FONT=Courier New]?>[/FONT]
[/COLOR][/COLOR]</select>
</html>