teknik informatika
Rabu, 11 Maret 2015
Kalkulator Sederhana
<!DOCTYPE html>
<html>
<head>
<title> Web Penjumlahan </title>
</head>
<body>
<form method = "post">
<table>
<td colspan="4" align="center"><h1><font color ="Red"> Kalkulator Sederhana</font></h1></td>
<tr>
<td align = "center"> Angka 1 </td>
<td> </td>
<td align = "center"> Angka 2 </td>
</tr>
<tr>
<td> <input type = "number" name = "angka1"/> </td>
<td> + </td>
<td> <input type = "number" name = "angka2"/> </td>
<td> = </td>
<?php
$hasil = "";
if(isset($_POST['penjumlahan'])){ #isset gunanya memanggil data
$angka1 = $_POST['angka1'];
$angka2 = $_POST['angka2'];
$hasil = $angka1 + $angka2;
}
?>
<td> <input type = "text" name = "hasil" disabled value = "<?php echo $hasil;?>"> </td>
<td> <input type = "submit" name = "penjumlahan" value = "Hasil perjumlahan"> </td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<form method = "post">
<table>
<tr>
<td align = "center"> Angka 1 </td>
<td> </td>
<td align = "center"> Angka 2 </td>
</tr>
<tr>
<td> <input type = "number" name = "angka1"/> </td>
<td> - </td>
<td> <input type = "number" name = "angka2"/></td>
<td> = </td>
<?php
$hasil = "";
if(isset($_POST['pengurangan'])){ #gunanya memanggil data
$angka1 = $_POST['angka1'];
$angka2 = $_POST['angka2'];
$hasil = $angka1 - $angka2;
}
?>
<td> <input type = "text" name = "hasil" disabled value = "<?php echo $hasil;?>"> </td>
<td> <input type = "submit" name = "penjumlahanngan" value = "Hasil Pengurangan"> </td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<form method = "post">
<table>
<tr>
<td align = "center"> Angka 1 </td>
<td> </td>
<td align = "center"> Angka 2 </td>
</tr>
<tr>
<td> <input type = "number" name = "angka1"/> </td>
<td> * </td>
<td> <input type = "number" name = "angka2"/></td>
<td> = </td>
<?php
$hasil = "";
if(isset($_POST['perkalian'])){
$angka1 = $_POST['angka1'];
$angka2 = $_POST['angka2'];
$hasil = $angka1 * $angka2;
}
?>
<td> <input type = "text" name = "hasil" disabled value = "<?php echo $hasil;?>"> </td>
<td> <input type = "submit" name = "perkalian" value = "Hasil Perkalian"> </td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body bgcolor="blue" background="dewi1.jpg">
<form method = "post">
<table>
<tr>
<td align = "center"> Angka 1 </td>
<td> </td>
<td align = "center"> Angka 2 </td>
</tr>
<tr>
<td> <input type = "number" name = "angka1"/> </td>
<td> / </td>
<td> <input type = "number" name = "angka2"/> </td>
<td> = </td>
<?php
$hasil = "";
if(isset($_POST['pembagian'])){
$angka1 = $_POST['angka1'];
$angka2 = $_POST['angka2'];
$hasil = $angka1 / $angka2;
}
?>
<td> <input type = "text" name = "hasil" disabled value = "<?php echo $hasil;?>"> </td>
<td> <input type = "submit" name = "pembagian" value = "Hasil Pembagian"> </td>
</tr>
</table>
</form>
</body>
</html>
Langganan:
Postingan (Atom)