18th Jul 2007 07:16pm
575 views | 0 comments
Flattr this

If you are making your own website registration form, then on the of chance you want an age selection box then don't spend hours manually typing it in, just a 3 lines of PHP and it will automatically do it for you. Very simple!

Below is the tiny bit of code that will automatically make a dropdown box for your site. Basically it starts at 1 and goes to 100. If you want to change the numbers then edit the $i = 1 value, which is the number it starts on, then edit the $i < 101 value, which is the number it goes upto plus one, so 54 would go upto 53.

<select name="age">
for($i=1;$i<101;$i++) {
     echo "<option>$i</option>";


Tweet ThisShare On FacebookShare On Google ReaderAdd To Del.icio.usShare On DiggShare On RedditShare On LinkedInShare On StumbleUpon


Post your comment...

Your Name:

Your Email:

Your Comment:

Are You Human?

Tick this box to confirm you're not a bot.

  • © Dale Hay, 2005 - 2016