-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculadoraGet.php
110 lines (98 loc) · 4.23 KB
/
calculadoraGet.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
$operando1 = (isset($_GET['operando1'])) ? $_GET['operando1'] : 0;
$operando2 = (isset($_GET['operando2'])) ? $_GET['operando2'] : 0;
if (isset($_GET['operador'])) {
switch ($_GET['operador']) {
case 'mas':
$resultado = $operando1 + $operando2;
$operador = " + ";
break;
case 'menos':
$resultado = $operando1 - $operando2;
$operador = " - ";
break;
case 'por':
$resultado = $operando1 * $operando2;
$operador = " * ";
break;
case 'entre':
$resultado = $operando1 / $operando2;
$operador = " / ";
break;
}
}
else {
$operador = '+';
$resultado = $operando1 + $operando2;
}
?>
<!DOCTYPE HTML>
<!--
Identity by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Identity by HTML5 UP</title>
<meta charset="utf-8" />
<meta name="Referrer" content="no-referrer" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="https://html5up.net/uploads/demos/identity/assets/css/main.css" />
<noscript><link rel="stylesheet" href="https://html5up.net/uploads/demos/identity/assets/css/noscript.css" /></noscript>
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
<!-- Main -->
<section id="main">
<header>
<span class="avatar"><img src="https://es.calcuworld.com/wp-content/uploads/sites/2/2013/02/matematicas-150x150.png" alt="" /></span>
<h2>Calculadora Básica</h2>
<form name="calculator">
<!-- Escribe el resultado como valor de la propiedad value -->
<input type="textfield" name="ans" value="<?php echo $operando1?> <?php echo $operador ?>
<?php echo $operando2 ?> = <?php echo $resultado?>">
<br>
<input type="button" value="1">
<input type="button" value="2">
<input type="button" value="3">
<input type="button" value="+">
<br>
<input type="button" value="4">
<input type="button" value="5">
<input type="button" value="6">
<input type="button" value="-">
<br>
<input type="button" value="7">
<input type="button" value="8">
<input type="button" value="9">
<input type="button" value="*">
<br>
<input type="button" value="0">
<input type="reset" value="c">
<input type="button" value="/">
<input type="button" value="=">
</form>
</header>
<footer>
<ul class="icons">
</ul>
</footer>
</section>
<!-- Footer -->
<footer id="footer">
<ul class="copyright">
<li>Copyright Jane Doe</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</footer>
</div>
<!-- Scripts -->
<script>
if ('addEventListener' in window) {
window.addEventListener('load', function() { document.body.className = document.body.className.replace(/\bis-preload\b/, ''); });
document.body.className += (navigator.userAgent.match(/(MSIE|rv:11\.0)/) ? ' is-ie' : '');
}
</script>
</body>
</html>