Kamis, 04 Oktober 2012

PHP (Latihan 6)

Posted by Unknown On Kamis, Oktober 04, 2012 | No comments
Gambar 1.0
Ketika Button Pesan Diclick Maka Akan Tampil Seperti Gambar 2.0
Gambar 2.0
Ketika Click Input Kembali Maka Akan Tampil Seperti Gambar 1.0

Coding/Listing Gambar 1.0 (Simpan Dengan Nama latihan6.html) :


<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Latihan 6</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/white%20house.jpg)">
<form action="studio.php" method="post">
<center><h1>Studio 22 Mal Jakarta</h1></center>
<hr />
<pre>
No Tiket         : <input type="text" size=10 name=notiket>
Keanggotaan      : <input type="radio" name=anggota value=Member>Member
                   <input type="radio" name=anggota value=Umum>Umum
No Studio        : <select name=nostudio>
                   <option>--Pilih No--</option>
                   <option value=1>1</option>
                   <option value=2>2</option>
                   <option value=3>3</option>
                   <option value=4>4</option>
                   </select>
Jumlah Tiket     : <input type="text" size=3 name=jml>
<br>
<input type="submit" value=Pesan><input type="reset" value=Batal>
</form>
</body>
</html>

Coding/Listing Gambar 2.0 (Simpan Dengan Nama studio.php) :


<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Latihan 6</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/white%20house.jpg)">
<?
$notiket=$_POST['notiket'];
$anggota=$_POST['anggota'];
$nostudio=$_POST['nostudio'];
$jml=$_POST['jml'];
if($nostudio=='1')
{
    $judul='Man In Black 2';
    $harga=25000;
}
else
if($nostudio=='2')
{
    $judul='The Passanger';
    $harga=30000;
}
else
if($nostudio=='3')
{
    $judul='The Shinjuku Incident';
    $harga=30000;
}
else
if($nostudio=='4')
{
    $judul='Sherlock Holmes 2';
    $harga=30000;
}
else
{
    $judul='Salah';
    $harga=0;
}

$total=$harga*$jml;
if($anggota=='Member')
{
    $diskon=0.1*$total;
}
else
{
    $diskon=0;
}
$totbay=$total-$diskon;

echo "<center><h1>Studio 22 Mal Jakarta</center></h1>";
echo "<center><h2>Pemesanan Tiket Bioskop</center></h2>";
echo "<hr />";
echo "<pre>";
echo "No Tiket          : $notiket<br>";
echo "Keanggotaan       : $anggota<br>";
echo "No Studio         : $nostudio<br>";
echo "Judul Film        : $judul<br>";
echo "Harga             : $harga<br>";
echo "Jumlah            : $jml<br>";
echo "Total Harga       : $total<br>";
echo "Diskon            : $diskon<br>";
echo "Total Bayar       : $totbay<br>";
?>
<br>
<center><h3><a href="latihan6.html">Input Kembali</a></h3></center>
</body>
</html>

0 komentar:

Posting Komentar

Blog Archive

Blogroll