<html>
<head>
<title>Thyo </title>
</head>
<body>
<form method="post" action="">
<table border="0">
<tr>
<td>Tipe Kamar</td>
<td>:</td>
<td><select name="tipe">
<option>Standar
<option>Suite
<option>Delux
<option>President
</select></td>
</tr>
<tr>
<td>Kategori</td>
<td>:</td>
<td><input type="radio" name="kat" value="0">Single
<input type="radio" name="kat" value="1">Double</td>
</tr>
<tr>
<td>Lama Menginap</td>
<td>:</td>
<td><input type="text" name="lama"> Hari</td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" value="Proses"><input type="reset" value="Batal"></td>
</tr>
</table>
</form>
<?PHP
$tipe=$_POST['tipe'];
$kat=$_POST['kat'];
$lama=$_POST['lama'];
$hrg=array("Standar"=>array("100000","150000"),
"Suite"=>array("200000","300000"),
"Delux"=>array("300000","400000"),
"President"=>array("500000","750000"));
$harga=$hrg[$tipe][$kat];
$pembayaran=$harga*$lama;
if ($harga>=300000)
$diskon=$pembayaran*0.1;
else
$diskon=0;
$total=$pembayaran-$diskon;
echo "Tarif Kamar : Rp. \n".$harga."<br>";
echo "Lama Menginap : ".$lama."\nHari<br>";
echo "Pembayaran : ".$pembayaran."<br>";
echo "Diskon : ".$diskon."<br>";
echo "Total Pembayaran : ".$total."<br>";
?>
</body>
</html>
Tidak ada komentar:
Posting Komentar