Tampilan Input:
Tampilan output :
Berikut ini adalah script inputnya :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {
font-weight: bold;
font-family: "Bodoni MT";
font-size: 24px;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="catoutput.php">
<p class="style3">TOKO CAT GUNA BANGUN JAYA</p>
<table width="370" border="0">
<tr>
<td width="120">Nama Custumer </td>
<td width="3">:</td>
<td width="225"><input name="nama" type="text" id="nama" /></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><input name="alamat" type="text" id="alamat" /></td>
</tr>
<tr>
<td>Jenis Cat </td>
<td>:</td>
<td><select name="jnscat" id="jnscat">
<option>MOWILEX</option>
<option>DANAPAINT</option>
<option>CATYLAC</option>
</select>
</td>
</tr>
<tr>
<td>Warna Cat </td>
<td>:</td>
<td><input name="wrnacat" type="radio" value="Merah" />
Merah
<input name="wrnacat" type="radio" value="Biru" />
Biru
<input name="wrnacat" type="radio" value="Kuning" />
Kuning</td>
</tr>
<tr>
<td>Jumlah Beli </td>
<td>:</td>
<td><input name="jumbel" type="text" id="jumbel" /></td>
</tr>
<tr>
<td colspan="3"><input type="submit" name="Submit" value="Hitung" />
<input type="reset" name="Submit2" value="Batal" /></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
Script outputnya :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: "Arial Black"}
.style2 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p class="style1">
<?php
$nama=$_POST['nama'];
$alamat=$_POST['alamat'];
$jnscat=$_POST['jnscat'];
$jumbel=$_POST['jumbel'];
$wrnacat=$_POST['wrnacat'];
if($jnscat=="CATYLAC")
{$a=40000;}
else if ($jnscat=="DANAPAINT")
{$a=30000;}
else if ($jnscat=="MOWILEX")
{$a=20000;}
$total=$a*$jumbel;
if ($jumbel>=5)
{$b=$total* 5/100;}
else if ($jumbel>=10)
{$b=$total* 10/100;}
else {$b=0;}
$totbay=$total-$b;
?>
</p>
<p class="style1 style2">TOKO CAT GUNA BANGUN JAYA </p>
<table width="500" border="0">
<tr>
<td colspan="4">------------------------------------------------------------------------------</td>
</tr>
<tr>
<td width="151">Nama Costumer </td>
<td width="8">:</td>
<td colspan="2"><?php echo $nama ?> </td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td colspan="2"><?php echo $alamat ?> </td>
</tr>
<tr>
<td>Jenis Cat </td>
<td>:</td>
<td colspan="2"><?php echo $jnscat ?> </td>
</tr>
<tr>
<td>Warna</td>
<td>:</td>
<td colspan="2"><?php echo $wrnacat ?> </td>
</tr>
<tr>
<td>Harga</td>
<td>:</td>
<td width="129"> </td>
<td width="194">Rp.<?php echo $a ?></td>
</tr>
<tr>
<td>Jumlah Beli </td>
<td>:</td>
<td colspan="2"><?php echo $jumbel ?> </td>
</tr>
<tr>
<td colspan="4">------------------------------------------------------------------------------(*)</td>
</tr>
<tr>
<td>Total Harga </td>
<td>:</td>
<td> </td>
<td>Rp.<?php echo $total ?> </td>
</tr>
<tr>
<td>Diskon</td>
<td>:</td>
<td> </td>
<td>Rp.<?php echo $b ?> </td>
</tr>
<tr>
<td colspan="4">------------------------------------------------------------------------------(-)</td>
</tr>
<tr>
<td>Total Bayar </td>
<td>:</td>
<td> </td>
<td>Rp.<?php echo $totbay ?> </td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4">------------------------------------------------------------------------------</td>
</tr>
<tr>
<td colspan="4"><a href="cat.php">Kembali</a></td>
</tr>
</table>
<p class="style1"> </p>
</form>
</body>
</html>