PHP
form belanja by: nazih 26 feb 2013<html>
<head>
<title>Belanja Online</title>
</head>
<body BGCOLOR="0ffft">
<center>
<h1><marquee color="0fffq">Belanja Online</h1></marquee>
</center>
<form method="POST" action="form_belanja.php">
<table border="0">
<tr>
<td>customer</td>
<td>:</td>
<td><input type="text" name="customer" value="" size="30"/><br/></td>
</tr>
<tr>
<td>Produk pilihan</td>
<td>:</td>
<td>TV :Rp.1.250.000,KULKAS : Rp.1.800.000, MESIN CUCI : Rp.3.400.000, AC : Rp.3.100.000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<select name="mk">
<option value="TV">TV</option>
<option value="KULKAS">KULKAS</option>
<option value="MESIN CUCI">MESIN CUCI</option>
<option value="AC">AC</option>
</select><br/></td>
</tr>
<tr>
<td>jumlah beli</td>
<td>:</td>
<td><input type="text" name="jumlah" value="" size="6"/></td>
</tr>
<td><br/>
<input type="submit" value="simpan" name="proses"/>
</form></td>
</table>
<tr><td colspan="3"><hr/></td></tr>
<?php
$customer=$_POST['customer'];
$product=$_POST['mk'];
$jb=$_POST['jumlah'];
$proses=$_POST['simpan'];
//if(trim($customer)!="" && trim($jb)!="" && is_numeric($jb)!="" && trim($product)!="" && $proses="simpan" )
// {
if($product =="TV") $ket=1250000;
else if($product =="KULKAS") $ket=1800000;
else if($product =="MESIN CUCI") $ket=3400000;
else $product=3100000;
$tb=$ket*$jb;
$pd=$tb*(15/100);
$pj=$tb*(10/100);
$hd=$tb-$pd+$pj;
echo '<br/>Nama customer ='.$customer;
echo '<br/>Product pilihan ='.$product;
echo '<br/>Jumlah belanja ='.$jb;
echo '<br/>Harga satuan ='.$ket;
echo '<br/>Total belanja ='.$tb;
echo '<br/>Potongan diskon ='.$pd;
echo '<br/>Pajak 10% ='.$pj;
echo '<br/>Harus dibayar ='.$hd;
// }
//else echo 'Perbaiki inputan anda <input type="button" onClick="history.back();" value="back">';
?>
</body>
</html>
0 comments:
Post a Comment
Terimakasih telah bergabung di blog saya.