script diskon php dalam satu form

<html>
<head>
<title></title>
</head>
<body>
<form method=”POST” action=””>
<h1>Toko majujaya.com</h1>

<table>
<tr>
<td>Nama Barang</td>
<td><input type=”text” name=”bil1″ /></td>
<tr>
<tr><br>
<td>Harga</td>
<td><input type=”text” name=”bil2″ /></td>
</tr>
<tr>
<tr><br>
<td>Quantity</td>
<td><input type=”text” name=”bil3″ /></td>
</tr>

<tr>
<td>
<label>
<input type=”submit” name=”Submit” value=”submit” id=”efrih”>
</label>
</td>
</tr>
</table>

</form>
<div id=”hasil”>

<?php
//
$bilangan1=$_POST[‘bil1’];// namabarang
$bilangan2=$_POST[‘bil2’];// harga
$bilangan3=$_POST[‘bil3’];// quantity

$bayar=($bilangan2*$bilangan3); {
echo “harga barang : Rp. $bayar,”;

}
if ($bayar >= 500000) {
$diskon=(($bayar*27)/100);
$total_bayar=($bayar-$diskon);
echo “$bilangan2”;
echo “<p>”;
echo “total bayar dengan diskon : Rp. $total_bayar,”;}

elseif ($bayar <= 500000) {echo “anda tidak mendapat diskon”;}
?>
<p>
<h4>Trimakasi atas kunjungan anda.</h4>
</p>
</div>
</div>
</div>
</body>
</html>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s