MEMBUAT FORM

 MEMBUAT FORM

Ini scriptnya : 

<html>
<head><title>Pengolahan Form - Checkbox</title></head>
<body>
<FORM ACTION="prosestugas.php" METHOD="POST" NAME="input">
<h2>HANDPHONE SHOP</h2>
    <p>Produk GSM Mobile (Best Price)</p>
    <input type="checkbox" name="hp1" value="Nokia 1208 Rp. 350.000,-"
    checked> Nokia 1208 Rp. 350.000,-<br>
    <input type="checkbox" name="hp2" value="Nokia 1661 Rp. 465.000,-">
    Nokia 1661 Rp. 465.000,-<br>
    <input type="checkbox" name="hp3" value="SonyEricsson K330 Rp. 485.000,-">
        SonyEricsson K330 Rp. 485.000,-<br>
        <input type="checkbox" name="hp4" value="Samsung Champ Rp. 865.000,-">
        Samsung Champ Rp. 865.000,-<br>
        <input type="checkbox" name="hp5" value="Samsung B3410 Rp. 1.624.000,-">
        Samsung B3410 Rp. 1.624.000,-<br>

        ====================================
        <p> Data Customer</p>
        ID Customer : <input type="text" name="id_customer"><br>
        Nama        : <input type="text" name="nama"><br>
        Email       : <input type="text" name="email"><br>
        Alamat      : <input type="text" name="alamat"><br>

        Member : <br>
        <input type="radio" name="member" value="member" checked>
Member<br>
<input type="radio" name="member" value="bukan">
Bukan<br>

Pembayaran :
<select name="pembayaran">
<option value="VISA">VISA</option>

Ini Hasilnya :



Script Proses

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <?php
echo "Produk yang dibeli :<br>";
if (isset($_POST['hp1'])) {
echo $_POST['hp1'] . "<br>";
$hp1 = 350000;
} else {
    $hp1 =0;
}
if (isset($_POST['hp2'])) {
echo $_POST['hp2'] . "<br>";
$hp2 = 465000;
} else {
    $hp2 =0;
}
if (isset($_POST['hp3'])) {
echo $_POST['hp3'] . "<br>";
$hp3 = 485000;
} else {
    $hp3 =0;
}
if (isset($_POST['hp4'])) {
echo $_POST['hp4'] . "<br>";
$hp4 = 865000;
} else {
    $hp4 =0;
}
if (isset($_POST['hp5'])) {
echo $_POST['hp5'] . "<br>";
$hp5 = 1624000;
} else {
    $hp5 =0;
}

$id_customer = $_POST['id_customer'];
$nama = $_POST['nama'];
$email = $_POST['email'];
$alamat = $_POST['alamat'];
$member = $_POST['member'];
$pembayaran = $_POST['pembayaran'];
echo "================================";
echo "<p> Data Customer </p>";
echo "ID Customer = $id_customer <br>";
echo "Nama = $nama <br>";
echo "Email = $email <br>";
echo "Alamat = $alamat <br>";
echo "Member = $member <br>";
echo "Pembayaran = $pembayaran <br>";
$totalbayar = $hp1 + $hp2 + $hp3 + $hp4 + $hp5;
echo "total pembayaran = $totalbayar <br>";

if ($member == "member"){
  echo "Diskon member = 10% <br>" ;
  $totalakhir = $totalbayar - ($totalbayar * 0.1);
  echo "Pembayaran akhir = $totalakhir <br>";
}
?>
</body>
</html>

Ini hasilnya :





Komentar

Postingan populer dari blog ini

Demo Bypass Login dengan SQL Injection

TCP/IP

Getting Started with NumPy