Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,016 members, 7,810,814 topics. Date: Saturday, 27 April 2024 at 03:59 PM

How To Code A Calculator Using Php - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Code A Calculator Using Php (1725 Views)

How To Make a DESKTOP Executable Software Using PHP,MYSQL,SQLITE / How To Make A Simple Calculator In Notepad Using .bat Format / How To Create A Simple Calculator Using Java Programing Language GUI (2) (3) (4)

(1) (Reply)

How To Code A Calculator Using Php by Whizzcute(m): 11:18pm On Oct 08, 2014
<html>
02
<head>
03
<title>Calculator</title>
04
</head>
05
06
07
<body>
08
<? php
09
10
if ( $option == add)
11
{
12
$one = $first ;
13
$two = $second ;
14
$result = $one + $two ;
15
echo $result ;
16
}
17
18
if ( $option == sub)
19
{
20
$one = $first ;
21
$two = $second ;
22
$result = $one - $two ;
23
echo $result ;
24
}
25
26
if ( $option == mul)
27
{
28
$one = $first ;
29
$two = $second ;
30
$result = $one * $two ;
31
echo $result ;
32
}
33
34
if ( $option == div)
35
{
36
$one = $first ;
37
$two = $second ;
38
$result = $one / $two ;
39
echo $result ;
40
}
41
42
43
?>
44
<form name= "calcform" >
45
<table border= "4" bordercolor= "blue"
bgcolor= "lightblue" >
46
47
<tr colspan= "2" rowspan= "2" >
48
<th colspan= "2" ><font size=6 face= "arial black"
color= "green" >CALCULATOR</font></th>
49
</tr>
50
51
<tr>
52
<td width= "200" align= "center" >Enter First Value</
td>
53
<td><input type= "text" name= "first" ></td>
54
</tr>
55
56
<tr>
57
<td width= "200" align= "center" >Enter Second
Value</td>
58
<td><input type= "text" name= "second" ></td>
59
</tr>
60
61
<tr>
62
<td></td>
63
<th colspan= "2" >
64
<input type= "button" name= "add" value= " + ">
65
<input type= "button" name= "sub2" value= " - " >
66
<input type= "button" name= "mul" value= " * ">
67
<input type= "button" name= "div" value= " / " >
68
</th>
69
</tr>
70
71
<tr>
72
<td width= "200" align= "center" >RESULT</td>
73
<td><input type= "text" name= "result" ></td>
74
</tr>
75
76
<tr>
77
<th colspan= "2" ><input type= "button"
name= "calcbutton" value= "CALCULATE" >
78
<input type= "reset" name= "resetbutton" value= "
RESET " ></th>
79
</tr>
80
81
</table>
82
</form>
83
</body>
84
</html>

(1) (Reply)

Flutter Restaurant Mobile App / Google Unveils Talking Shoes / Looking For A Full-stack Developer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.