-
Notifications
You must be signed in to change notification settings - Fork 0
/
versao_expandida.php
84 lines (78 loc) · 1.6 KB
/
versao_expandida.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
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
<?php
$a = $b = $c = $d = null;
$p = $_POST;
if (!empty($p) && count(array_filter($p['v'])) > 2)
{
$pv = $p['v'];
$a = $pv[0];
$b = $pv[1];
$c = $pv[2];
$d = $pv[3];
if (!$d)
{
$d = ($b * $c) / $a;
}
elseif (!$a)
{
$a = ($b * $c) / $d;
}
elseif (!$b)
{
$b = ($a * $d) / $c;
}
elseif (!$c)
{
$c = ($a * $d) / $b;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
*
{
text-align: center;
color: #BCB5A1;
font-variant: small-caps;
margin: auto
}
body, input
{
background-color: #1A1617
}
input
{
border: 1px dotted #BCB5A1;
padding: 5px
}
input[type=submit]
{
cursor: pointer;
border-style: solid
}
h1, p, table
{
margin-bottom: 15px
}
</style>
</head>
<body>
<form method="post">
<h1>Calculadora de Proporção</h1>
<p>Preencha três dos campos abaixo com números</p>
<table>
<tr>
<td><input type="text" name="v[]" value="<?php echo $a ?>"></td>
<td rowspan="2">=</td>
<td><input type="text" name="v[]" value="<?php echo $b ?>"></td>
</tr>
<tr>
<td><input type="text" name="v[]" value="<?php echo $c ?>"></td>
<td><input type="text" name="v[]" value="<?php echo $d ?>"></td>
</tr>
</table>
<input type="submit" value="Calcular"></form>
</body>
</html>