Anda di halaman 1dari 4

Nama : Rikarsus Mba Dala Pati

NIM : 15210208

Kelas : 15.3A.01

Input.php

<html>
<head>
<title> Perhitungan Bangun Datar </title>
</head>
<body>
<center>
<h1>Rumus-Rumus</h1>

<form action="output.php" method="post">


<table border="1">

<tr>
<td>Bilangan 1</td>
<td><input type="text" name="bil1" ></td>
</tr>
<tr>
<td>Bilangan 2</td>
<td><input type="text" name="bil2" ></td>
</tr>
<tr>
<td colspan="2" align=center >
<input type="radio" name="jenis" value="segitiga"> Segitiga </br>
<input type="radio" name="jenis" value="persegipanjang"> Persegi
Panjang </br></br>
</td>
</tr>
</table>
<input type="submit" name="hitung">
<input type="reset" name="Batal">

</form>

</center>
</body>
</html>

Output.php

<html>
<head>
<title> Perhitungan Bangun Datar </title>
</head>
<body>
<center>
<h1>Hasil Hitung Rumus</h1>
<?php
if(isset($_POST['hitung'])){
$bil1 = $_POST['bil1'];
$bil2 = $_POST['bil2'];
$jenis = $_POST['jenis'];
if(($bil1=="0") and ($bil2 =="0")){
$hasil=0;
}else{
switch ($jenis) {
case 'segitiga':
$hasil = (1/2*($bil1*$bil2));
break;
case 'persegipanjang':
$hasil = $bil1*$bil2;
break;
}
}
}
?>
<?php
echo"Nilai 1 adalah $bil1 </br>";
echo"Nilai 2 adalah $bil2 </br>";
echo"Rumus Yang di Pilih adalah $jenis </br>";
echo"Hasil Perhitungan Rumus $hasil </br>";

?>
<a href="input.php">INPUT DATA LAGI</a>
</center>
</body>
</head>
</html>

Hasil

Anda mungkin juga menyukai