PHP Example
Screen shot
Dynamically Print Date Of Birth

<?php

if(isset($_POST['btn']))

{

$year  = (date("Y")-1) - $_POST['year'];

$month = date("m") - $_POST['month'];

$day   = date("d") - $_POST['day'];

echo "your date of birth is ".$_POST['day']."-".$_POST['month']."-".$_POST['year']."<br>";

echo "your age is $month month $year";

}

?>

<html>

<head>

<title>PHP Example</title>

</head>

<body>

<form action="" method="post">

<?php

echo "select Your date of birth";

$month_array=array("January","February","March","April","May","June",

"July","August","September","October","November","December");

 

echo "<select name=\"day\">";

$i = 1;

while ( $i <= 31 ) {

   echo "<option value=".$i.">".$i."</option>";

   $i++;

}

echo "</select>";

echo "<select name=\"month\">";

$i = 0;

while ( $i <= 11 ) {

   echo "<option value=".$month_array[$i].">".$month_array[$i]."</option>";  

   $i++;

}

echo "</select>";

echo "<select name=\"year\">";

$i = 1900;

while ( $i <= 2007 ) {  

   echo "<option value=".$i.">".$i."</option>";  

   $i++;

}

echo "</select>";

?>

</form>

</body>

</html>

<?php
if(isset($_POST['btn'])){
   $year  = (date("Y")-1) - $_POST['year'];
   $month = date("m") - $_POST['month'];
   $day   = date("d") - $_POST['day'];
echo "your date of birth is ".$_POST['day']."-".$_POST['month']."-".$_POST['year']."<br>";
echo "your age is $month month $year";
}
?>
<html>
<head>
<title>PHP Example</title>
</head>
<body>
<form action="" method="post">
<?php
echo "select Your date of birth";
$month_array=array("January","February","March","April","May","June",
"July","August","September","October","November","December");
echo "<select name=\"day\">";
$i = 1;
while ( $i <= 31 ){
   echo "<option value=".$i.">".$i."</option>";
   $i++;
}
echo "</select>";
echo "<select name=\"month\">";
$i = 0;
while ( $i <= 11 ) {
   echo "<option value=".$month_array[$i].">".$month_array[$i]."</option>";  
   $i++;
}
echo "</select>";
echo "<select name=\"year\">";
$i = 1900;
while ( $i <= 2007 ) {  
   echo "<option value=".$i.">".$i."</option>";  
  $i++;
}
echo "</select>";
?>
</form>
</body>
</html>

img11

You can download source code here