Professional Documents
Culture Documents
P 65202040011
P 65202040011
โปรแกรมที่เขียน
โค้ด
<html>
<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>โปรแกรมคำณวนเงิน (เหรียญ/ธนบัตร)</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-
ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
</style>
</head>
<body>
<br>
<div class="container">
<h2 class ="text-center">โปรแกรมคำณวนเงิน (เหรียญ/ธนบัตร)</h2>
<h4 class ="text-center">พัฒนาโปรแกรมโดย นาย ปุณยวัจน์</h4>
<form method= "post" >
<p>
<label>
<center>
<div class = "form-group">
เหรียญ 1   <input type="text"name="money1" /> เหรียญ
  <br>
</div>
<div class = "form-group">
<br> เหรียญ 2   <input type="text"name="money2" /> เหรียญ  
<br>
</div>
<div class = "form-group">
<br> เหรียญ 5   <input type="text"name="money3" /> เหรียญ  
<br>
</div>
<div class = "form-group">
<br> เหรียญ 10   <input type="text"name="money4" /> เหรียญ   <br>
</div>
<div class = "form-group">
<br> แบงค์ 20   <input type="text"name="money5" /> บาท  
<br>
</div>
<div class = "form-group">
<br> แบงค์ 50   <input type="text"name="money6" /> บาท  
<br>
</div>
<div class = "form-group">
<br> แบงค์ 100   <input type="text"name="money7" /> บาท   <br>
</div>
<div class = "form-group">
<br> แบงค์ 1000   <input type="text"name="money9" /> บาท  
<br>
</div>
<br>
<br>
</center>
</label>
</p>
</form>
<center>
<?php
isset( $_POST['money1'] ) ? $money1 = $_POST['money1'] : $money1 = "";
isset( $_POST['money2'] ) ? $money2 = $_POST['money2'] : $money2 = "";
isset( $_POST['money3'] ) ? $money3 = $_POST['money3'] : $money3 = "";
isset( $_POST['money4'] ) ? $money4 = $_POST['money4'] : $money4 = "";
isset( $_POST['money5'] ) ? $money5 = $_POST['money5'] : $money5 = "";
isset( $_POST['money6'] ) ? $money6 = $_POST['money6'] : $money6 = "";
isset( $_POST['money7'] ) ? $money7 = $_POST['money7'] : $money7 = "";
isset( $_POST['money8'] ) ? $money8 = $_POST['money8'] : $money8 = "";
isset( $_POST['money9'] ) ? $money9 = $_POST['money9'] : $money9 = "";
$presum1 = (int)$money1 * 1;
$presum2 = (int)$money2 * 2;
$presum3 = (int)$money3 * 5;
$presum4 = (int)$money4 * 10;
$presum5 = (int)$money5 * 20;
$presum6 = (int)$money6 * 50;
$presum7 = (int)$money7 * 100;
$presum8 = (int)$money8 * 500;
$presum9 = (int)$money9 * 1000;
$sum = (int)$presum1 + (int)$presum2 + (int)$presum3 +(int)$presum4 + (int)$presum5 +
(int)$presum6 + (int)$presum7 + (int)$presum8 + (int)$presum9;
echo "จำนวนเงิน " . $sum . " บาท";
?>
</center>
</body>
</html>
โปรแกรมที่ทำงานแล้ว