-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.1.php
35 lines (30 loc) · 875 Bytes
/
2.1.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
<html>
<head>
</head>
<body>
<FORM action="2.1.php" method="GET">
<input type="text" placeholder="Liczba pierwsza" name="a">
<input type="text" placeholder="Liczba druga" name="b">
<input type="submit" value="Dodawanie" name="add">
<input type="submit" value="Odejmowanie" name="sub">
<input type="submit" value="Mnożenie" name="mul">
<input type="submit" value="Dzielenie" name="div">
<input type="submit" value="Modulo" name="mod">
</FORM>
<?php
$number_a = $_GET['a'];
$number_b = $_GET['b'];
if($_GET['add'] != null){
echo ($number_a + $number_b);
} elseif($_GET['sub'] != null){
echo ($number_a - $number_b);
} elseif($_GET['mul'] != null){
echo ($number_a * $number_b);
} elseif($_GET['div'] != null){
echo ($number_a / $number_b);
} elseif($_GET['mod'] != null){
echo ($number_a % $number_b);
}
?>
</body>
</html>