-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmedia.php
28 lines (27 loc) · 820 Bytes
/
media.php
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
<?php
if (isset($_GET['nota1']) && isset($_GET['nota2']) && isset($_GET['nota3']) && isset($_GET['nota4'])) {
$recebeuMedias = true;
$nota1 = $_GET['nota1'];
$nota2 = $_GET['nota2'];
$nota3 = $_GET['nota3'];
$nota4 = $_GET['nota4'];
$media = ($nota1 * 1 + $nota2 * 2 + $nota3 * 3 + $nota4 * 4) / 10;
} else {
$recebeuMedias = false;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php if($recebeuMedias): ?>
Sua média é <?php print $media; ?><br />
<a href="media.html">calcule uma nova média</a>
<?php else: ?>
<a href="media.html">calcule sua média</a>
<?php endif; ?>
</body>
</html>