WEB PROGRAMMING IF BERSARANG/ IF MAJEMUK
Tampilan input:
<html>
<head>
<title>Title here!</title>
</head>
<body bgcolor=RED>
<form method="post" action="save_pert8.php">
<pre>
<b><h2>TOKO SUSU JAYA</h2></b>
Nama Customer : <input type="text" name="nama">
Alamat : <input type="text" name="alamat">
Jenis Susu : <select name=jenis>
<option value=0>PILIH
<option value="BENDERA">BENDERA
<option value="DANCOW">DANCOW
<option value="NUTRILION">NUTRILION
</SELECT>
Ukuran <input type=radio name=ukuran value=besar uncheked>BESAR
<input type=radio name=ukuran value=sedang uncheked>SEDANG
<input type=radio name=ukuran value=kecil uncheked>KECIL
Jumlah : <input type=text name=jumlah size=3> <BR><BR>
<input type=submit value=PROSES> <input type=reset value=BATAL>
</pre>
*PESAN SUSU SEGAR HUBUNGI: 0211010
</form>
</body>
</html>
Simpan scrip diatas dengan nama:input_pert8.php
Ketentuan:
Jenis | Ukuran | Harga |
Bendera | Besar | 50000 |
Sedang | 35000 | |
kecil | 25000 | |
Dancow | Besar | 45000 |
Sedang | 30000 | |
kecil | 20000 | |
Nutrilion | Besar | 40000 |
Sedang | 32000 | |
kecil | 22000 |
-Total harga=harga x jumlah beli
-Diskon didapat dari Jika jumlah beli lebih besar dari 10 maka diskon 10% dari total harga
-total bayar=total harga - diskon
Tampilan output:
Listing output:
<html>
<head>
<title>Title here!</title>
</head>
<body>
<font face=arial size=5>
<font color=#FF0080>
<pre>
<?
echo"==============================<br>";
echo"TOKO SUSU MAKMUR JAYA <br>";
echo"==============================<br>";
echo"Nama Customer :$nama<br>";
echo"Alamat :$alamat <br>";
echo"Jenis Susu :$jenis <br>";
echo"Ukuran :$ukuran <br>";
if($jenis=="BENDERA")
{
if($ukuran=="BESAR")
{$harga=50000;}
else if ($ukuran=="SEDANG")
{$harga=35000;}
else
{$harga=25000;}
}
else if($jenis=="DANCOW")
{
if($ukuran=="BESAR")
{$harga=45000;}
else if ($ukuran=="SEDANG")
{$harga=30000;}
else
{$harga=20000;}
}
ELSE
{
if($ukuran=="BESAR")
{$harga=40000;}
else if ($ukuran=="SEDANG")
{$harga=32000;}
else
{$harga=22000;}
}
echo"harga :$harga <br>";
echo"Jumlah Beli :$jumlah <br>";
echo"==============================<br>";
$totalharga =$harga* $jumlah;
echo"Total Harga :$totalharga <br>";
if($jumlah>=5)
{$diskon=0.05 * $totalharga;}
else if($jumlah>=10)
{$diskon=0.1 * $totalharga;}
else
$diskon=0;
echo"Diskon :$diskon <br>";
$ttlbayar=$totalharga - $diskon;
echo"==============================<br>";
echo"Total Bayar :$ttlbayar <br>";
echo"==============================<br>";
echo"--------TERIMA KASIH----------<br>";
?>
</pre>
</body>
</html>
Simpan scrip diatas dengan nama:output_pert8.php
KOMENTAR JANGAN SPAM YA ;)
Posting Komentar
terima kasih atas komentar nya...