Perhitungan Pengurangan Menggunakan PHP

Assalamualaikum sobat. Haaaaaahh rasanya lama  banget udah g buka blogger. Kali ini saya akan berbagi sedikit ilmu  tentang PHP. Ya mungkin  php yang paling dasar. Paling nggak bisa buat di ajarkan bagi adek-adeknya. Hehehe
Ini adalah operasi pengurangan menggunakan PHP
Berikut kodenya
<!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=utf-8" />
<title>Belajar PHP Awal</title>
<style>
.kotak {
    background:linear-gradient(to bottom, #eee, #fafafa);
    padding:10px;
    width:300px;
    height:auto;
    border:2px solid #ddd;
    box-shadow:0 2px 9px  #ddd;
    margin:auto;
    margin-top:100px;
    }
input[type=email],
  input[type=number],
  input[type=password],
  input[type=tel],
  input[type=text],
  input[type=url] {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  width:234px;
  height: 36px;
  padding: 0 8px;
  margin: 0;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-top: 1px solid #c0c0c0;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -moz-border-radius: 1px;
  -webkit-border-radius: 1px;
  border-radius: 1px;
  font-size: 15px;
  color: #404040;
  }
  input[type=email]:hover,
  input[type=number]:hover,
  input[type=password]:hover,
  input[type=tel]:hover,
  input[type=text]:hover,
  input[type=url]:hover {
  border: 1px solid #b9b9b9;
  border-top: 1px solid #a0a0a0;
  -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  }
  input[type=email]:focus,
  input[type=number]:focus,
  input[type=password]:focus,
  input[type=tel]:focus,
  input[type=text]:focus,
  input[type=url]:focus {
  outline: none;
  border: 1px solid #4d90fe;
  -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  }
input[type=submit] {
    background: linear-gradient(to bottom, #0088CC, #0044CC);
    border: 1px solid #0088CC;
    color: #FFF;
    margin: 4px 10px;
    padding: 5px;
    width: 100px;
    border-radius:4px;
}

input[type=submit]:hover {
    cursor: pointer;
}

input[type=submit]:active {
    background: #0044CC;
}
</style>
</head>

<body>
<div class="kotak">
<form action="" method="post">
<input type="text" name="a" value="" />
<br />
<input type="text" name="b" value="" />
<br />
<input  type="submit" name="hitung" value="Hitung" />
<br />
<?php
if (isset($_POST['hitung'])){
    $a = $_POST['a'];
    $b = $_POST['b'];
$hasil =0;
    $hasil = $a - $b;
echo "Hasil = $hasil";
}
?>
</form>
</div>
</body>
</html>
Previous
Next Post »

1 comments:

Click here for comments
Anonymous
admin
October 19, 2014 at 1:25 AM ×

I appreciate, result in I discovered just what I
was taking a look for. You have ended my four day lengthy hunt!
God Bless you man. Have a nice day. Bye

Review my page: tefal steam iron

Congrats bro Anonymous you got PERTAMAX...! hehehehe...
Reply
avatar

Tata Cara Berkomentar yang Baik dan Benar :

1. Gunakan Bahasa yang Sopan.
2. Biasakanlah berkomentar sebelum meninggalkan.
3. Usahakan jangan menggunakan anonymous
4. Saya sangat berterima kasih atas komentar yang kalian berikan
5. Admin selalu berusaha melakukan yang terbaik untuk para pengunjung ConversionConversion EmoticonEmoticon

Thanks for your comment