-
Language
PHP
-
Description
Age calculation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Age calculation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
<html>
<head>
<title>Age calculation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
if ($_SERVER['REQUEST_METHOD']=='POST')
{
$birth_day = intval ($_POST['birth_day']);
$birth_month = intval ($_POST['birth_month']);
$birth_year = intval ($_POST['birth_year']);
$current_day = intval ($_POST['current_day']);
$current_month = intval ($_POST['current_month']);
$current_year = intval ($_POST['current_year']);
$age=$current_year-$birth_year;
if($birth_month>$current_month||($birth_month==$current_month&&$birth_day>$current_day))
$age=$age-1;
echo 'Value of age: ' . $age . "<br/>\n";
}
<form method="post">
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<label for="birth_day">Enter the value of birth day:</label>
</td>
<td>
<input name="birth_day" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="birth_month">Enter the value of birth month:</label>
</td>
<td>
<input name="birth_month" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="birth_year">Enter the value of birth year:</label>
</td>
<td>
<input name="birth_year" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_day">Enter the value of current day:</label>
</td>
<td>
<input name="current_day" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_month">Enter the value of current month:</label>
</td>
<td>
<input name="current_month" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_year">Enter the value of current year:</label>
</td>
<td>
<input name="current_year" required="required" step="1" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Process" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<label for="birth_day">Enter the value of birth day:</label>
</td>
<td>
<input name="birth_day" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="birth_month">Enter the value of birth month:</label>
</td>
<td>
<input name="birth_month" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="birth_year">Enter the value of birth year:</label>
</td>
<td>
<input name="birth_year" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_day">Enter the value of current day:</label>
</td>
<td>
<input name="current_day" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_month">Enter the value of current month:</label>
</td>
<td>
<input name="current_month" required="required" step="1" type="number" />
</td>
</tr>
<tr>
<td>
<label for="current_year">Enter the value of current year:</label>
</td>
<td>
<input name="current_year" required="required" step="1" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Process" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>