dropdown box to make birthday

Associate
Joined
7 Nov 2004
Posts
1,755
Location
Southampton/Oxford
hi yall, can someone give me a hint on how to code a input box or make a drop down box using either php or html for a user to enter their dob?
 
Yes! but for dates lol so as in they need to enter their DOB

try editing it

here is a better example:

Code:
<select>
  <option value='01'>01</option>
  <option value='02'>02</option>
  <option value='03'>03</option>
  <option value='04'>04</option>
</select>


<select>
  <option value='jan'>January</option>
  <option value='feb'>Febuary</option>
  <option value='mar'>March</option>
  <option value='apr'>April</option>
</select>


<select>
  <option value='1990'>1990</option>
  <option value='1991'>1991</option>
  <option value='1992'>1992</option>
  <option value='1993'>1993</option>
</select>
 
Ah found that on my searches but it's abit long winded, was looking as like a formula type thing where it can do it automatically instead of typing it out all the way to the 1950's for example either using IF statements or such
 
Code:
<html>
<head>
<script>

 function setYear(){
alert('top');
var selbox = document.myform.years;
alert(selbox);
selbox.options.length = 0;
  for(var i =1950; i<1955;i++){
     selbox.options[selbox.options.length] = new Option(i,i);
  }
}
</script>
</head>
<body onload="setYear()">
<form name="myform">
<select id="years" name="years">
</select>
</form>
</body>
</html>

or just got for one of the many date picker controls on the internet so you don't have to mess with the problems with leap years and days in the months.
http://dali.mty.itesm.mx/~hugo/js/datepickercontrol/
 
Last edited:
Back
Top Bottom