-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8calc.php
More file actions
34 lines (32 loc) · 694 Bytes
/
Copy path8calc.php
File metadata and controls
34 lines (32 loc) · 694 Bytes
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
<?php
if (isset($_POST['sub']))
{
$txt1=$_POST['n1'];
$txt2=$_POST['n2'];
$oprnd=$_POST['sub'];
if($oprnd=="+")
$res=$txt1+$txt2;
else if($oprnd=="-")
$res=$txt1-$txt2;
else if($oprnd=="x")
$res=$txt1*$txt2;
else if($oprnd=="/")
$res=$txt1/$txt2;
}
?>
<html>
<form method="post" action="">
Calculator
</br>
No1:<input name="n1" value="<?php echo $txt1; ?>" />
</br>
No2:<input name="n2" value="<?php echo $txt2; ?>"/>
</br>
Res:<input name="res" value="<?php echo $res; ?>"/>
</br>
<input type="submit" name="sub" value="+">
<input type="submit" name="sub" value="-">
<input type="submit" name="sub" value="x">
<input type="submit" name="sub" value="/">
</form>
</html>