0

I want to calculate the age of a person, when he/she inputted his/her brthdy on the form, it will shows his/her bday in year/month/day format
Example, the user chooses February 11 1994 on the drop down list. when he/she click submit, it will display his/her age
Output must be like this: Your age is: 17 years, 6 months, and 29 days.

this is my html code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Web Development</title>
<style type="text/css">
body {
background: url(bg.jpg);
background-size: 100%;
background-origin: content;
}

p{
color: #FFFFFF;
font-size:24px;
font-weight:bold;
text-align:center;
}

td{
color: #00477D;
font-size: 15px;
font-weight: bold;
font-style: Century Gothic;
}
</style>
</head>

<body>



<div id="header">
<p>Personal Information</p>
</div>

<center>
<form action="nameage2.php" method="post">


<table border="1">
<tr>
<td>



Name: <input type="text" name="name" style="color:#FF0000" />

</td>
</tr>
<tr><td>
Birthday: <select name="month">
				<option value="" style="color: #008E00">Select a Month</option>
                <option value="Jan" style="color: #008E00">January</option>
                <option value="Feb" style="color: #008E00">February</option>
                <option value="March" style="color: #008E00">March</option>
                <option value="Apr" style="color: #008E00">April</option>
                <option value="May" style="color: #008E00">May</option>
                <option value="June" style="color: #008E00">June</option>
                <option value="July" style="color: #008E00">July</option>
                <option value="Aug" style="color: #008E00">August</option>
                <option value="Sept" style="color: #008E00">September</option>
				<option value="Oct" style="color: #008E00">October</option>
				<option value="Nov" style="color: #008E00">November</option>
				<option value="December" style="color: #008E00">December</option>
			</select>
<select name="day">
				<option value="" style="color: #008E00">Select a Day</option>
                <option value="1" style="color: #008E00">1</option> <option value="2" style="color: #008E00">2</option><option value="3" style="color: #008E00">3</option>
                <option value="4" style="color: #008E00">4</option><option value="5" style="color: #008E00">5</option><option value="6" style="color: #008E00">6</option>
                <option value="7" style="color: #008E00">7</option> <option value="8" style="color: #008E00">8</option><option value="9" style="color: #008E00">9</option>
				<option value="10" style="color: #008E00">10</option><option value="11" style="color: #008E00">11</option><option value="12" style="color: #008E00">12</option>
                <option value="13" style="color: #008E00">13</option><option value="14" style="color: #008E00">14</option><option value="15" style="color: #008E00">15</option>
                <option value="16" style="color: #008E00">16</option><option value="17" style="color: #008E00">17</option><option value="18" style="color: #008E00">18</option>
                <option value="19" style="color: #008E00">19</option><option value="20" style="color: #008E00">20</option><option value="21" style="color: #008E00">21</option>
                <option value="22" style="color: #008E00">22</option><option value="23" style="color: #008E00">23</option><option value="24" style="color: #008E00">24</option>
                <option value="25" style="color: #008E00">25</option><option value="26" style="color: #008E00">26</option><option value="27" style="color: #008E00">27</option>
                <option value="28" style="color: #008E00">28</option><option value="29" style="color: #008E00">29</option><option value="30" style="color: #008E00">30</option>
                <option value="31" style="color: #008E00">31</option>
</select>
<select name="year">
				<option value="" style="color: #008E00">Select a Year</option>
              	<option value="9" style="color: #008E00">1985</option><option value="10" style="color: #008E00">1986</option><option value="11" style="color: #008E00">1987</option>
                <option value="12" style="color: #008E00">1988</option> <option value="13" style="color: #008E00">1989</option><option value="1" style="color: #008E00">1990</option> 
                <option value="2" style="color: #008E00">1991</option><option value="3" style="color: #008E00">1992</option><option value="4" style="color: #008E00">1993</option>
                <option value="5" style="color: #008E00">1994</option><option value="6" style="color: #008E00">1995</option><option value="7" style="color: #008E00">1996</option> 
                <option value="8" style="color: #008E00">1997</option>
</select>           
            
            <br />
</td></tr>



<tr>
<td>
<center>
<input type="submit" name="SubmitForm" value="Submit the From" style="background:#1919B3"/>

</center>
</td>
</tr>

</table>



</form>
</center>
</body>
</html>

this is my unfinish php code:

<html>
<head>
	<title>Web Development</title>
</head>

<body>
<h2 style="text-align: center">Personal Information</h2>


<?php
// FOR PERSONAL INFORMATION PHP

//text area name
if(empty($_POST['name']))
{
echo "<p>You didn't enter your name.</p>\n";
}
else
{
echo "Your Name: <b>" . $_POST['name'] . "</b><br />\n";
}
?>

</body>

</html>

PLEASE DO HELP ME :( NEEDED TODAY :( PLEASE :( :(

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by diafol
1

What, you don't like to read ? Everything you need is on that page and in the examples/comments... Try first, if you still have questions, post your code and your problems.

Edited by pritaeas: n/a

0

still cant get it :(

What you can't get access to the date diff link??

It works for me. If on the other hand you can get access and don't "get" it. There's little we can do I would imagine as the example supplied by contributors would probably be exactly the same or at least very similar to the examples shown in the manual.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.