Web Progamming 1 || Pertemuan 6
Senin 20 April 2020
Tugas Slide
Latihan 1
JAWABAN :
SCRIPT :
INPUT :
<html>
<head>
<title></title>
</head>
<body>
<form action="tujuan1.php" method="post">
<h2>KONSER AMAL INDAHNYA BERBAGI</h2>
<pre>
Nama Pemesan : <input type="text" name="namapemesan"><br>
Kode Studio : <select name="kodestudio">
<option value="Studio1">Studio 1
<option value="Studio2">Studio 2
</select><br>
Jenis Kelas : <input type="radio" name="jeniskelas"value="VIP">VIP<input type="radio" name="jeniskelas"value="Festival">Festival<br>
Jumlah Tiket : <input type="text" name="jumlahtiket"><br>
<input type="submit" value="Tampil"><input type="reset"value="Batal">
</pre>
</form>
</body>
</html>
OUTPUT :
<html>
<head>
<title></title>
</head>
<body>
<?php
$nama=$_POST['namapemesan'];
$kode=$_POST['kodestudio'];
$kelas=$_POST['jeniskelas'];
$jumlah=$_POST['jumlahtiket'];
$bintang;
switch ($kode){
case "Studio1":$bintang = "Opick";break;
case "Studio2":$bintang = "Raihan";break;
}
$total;
$harga;
if($kelas=="VIP"){
$harga=500000;
$total=$harga*$jumlah;
}else
{
$harga=250000;
$total=$harga*$jumlah;
}
?>
<p align="center"><h2>KONSER AMAL INDAHNYA BERBAGI</p></h2>
================================================
<br>
Nama Pemesan :<?php echo $nama;?>
<br>
Kode Studio :<?php echo $kode;?>
<br>
Bintang Tamu :<?php echo $bintang;?>
<br>
Jenis Kelas :<?php echo $kelas;?>
<br>
Harga :<?php echo $harga;?>
<br>
Jumlah Tiket :<?php echo $jumlah;?>
<br>
================================================
<br>
Total :<?php echo $total;?>
<br>
<a href="latihan1.php">Kembali Ke Awal</a>
</body>
</html>
TAMPILAN :
INPUT :
OUTPUT :
Latihan 2
SCRIPT :
INPUT :
<html>
<head>
<title>TOKO CAT</title>
</head>
<body>
<form action="tujuan2.php" method="post">
<h2>TOKO CAT GUNA BANGUN JAYA</h2>
<pre>
Nama Customer : <input type="text" name="nama"><br>
Alamat : <input type="text" name="alamat"><br>
Jenis CAT : <select name="jenis">
<option value="MOWILEX">MOWILEX
<option value="DANAPAINT">DANAPAINT
<option value="CATYLAC">CATYLAC
</select><br>
Warna Cat : <input type="radio" name="warna" value="Merah">Merah <input type="radio" name="warna" value="Biru">Biru <input type="radio" name="warna" value="Kuning">Kuning<br>
Jumlah Beli : <input type="text" name="jumlahbeli"><br>
<input type="submit" value="Hitung"><input type="reset" value="Batal">
</pre>
</from>
</body>
</html>
OUTPUT :
<html>
<head>
<title></title>
</head>
<body>
<?php
$nama=$_POST['nama'];
$alamat=$_POST['alamat'];
$jenis=$_POST['jenis'];
$warna=$_POST['warna'];
$jumlah=$_POST['jumlahbeli'];
if ($jenis=="MOWILEX") {
$harga=20000;
}
else if ($jenis=="DANAPAINT") {
$harga=30000;
}
else if ($jenis=="CATYLAC") {
$harga=40000;
}
$total=$harga*$jumlah;
?>
<h2>TOKO CAT GUNA BANGUN JAYA</h2>
<pre>
------------------------------------------------------------------------
<br>
Nama Customer :<?php echo $nama;?>
<br>
Alamat :<?php echo $alamat;?>
<br>
Jenis CAT :<?php echo $jenis;?>
<br>
Warna :<?php echo $warna;?>
<br>
Harga :<?php echo "Rp.".number_format($harga);?>
<br>
------------------------------------------------------------------------
<br>
Total Harga :<?php echo "Rp.".number_format($total);?>
<?php
if ($jumlah>=5) {
$diskon=$total*5/100;
}
elseif ($jumlah>=10) {
$diskon=$total*10/100;
}
else
{
$diskon=0;
}
?>
<br>
Diskon :<?php echo "Rp.".number_format($diskon);?>
<br>
------------------------------------------------------------------------
<?php
$totbay=$total-$diskon;
?>
<br>
Total Bayar :<?php echo "Rp.".number_format($totbay);?>
<br>
<br>
<a href="latihan2.php">Kembali</a>
</pre>
</body>
</html>
TAMPILAN
INPUT :
OUTPUT :






Komentar
Posting Komentar