-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaksi.php
60 lines (59 loc) · 2.23 KB
/
transaksi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</!DOCTYPE html>
<html>
<head>
<?php include ('partials/head.php'); ?>
</head>
<body>
<?php include ('partials/menu.php'); ?>
<script type="text/javascript">
function isi_otomatis(){
var nama = $("#nama").val();
$.ajax({
url: 'includes/isiotomatis.php',
data:"nama="+nama ,
}).success(function (data) {
var json = data,
obj = JSON.parse(json);
$('#id').val(obj.idkopi);
$('#stok').val(obj.stok);
$('#harga').val(obj.harga);
});
}
</script>
<div class="container">
<div class="card">
<h2>Transaksi</h2><hr>
<form action="konfirmasitransaksi.php" method="POST">
<!-- <label>ID Kopi : </label>
<div class="kolom">
<input type="text" id="id" name="idkopi" placeholder="Masukkan ID Kopi" required onchange="isi_otomatis()"><br>
</div> -->
<input type="hidden" id="id" name="idkopi">
<label>Pilih Kopi : </label>
<div class="kolom">
<!-- <input type="text" id="nama" name="nama" placeholder="Masukkan Nama Kopi" readonly> -->
<select id="nama" name="nama" onchange="isi_otomatis()">
<?php $tampil=mysqli_query($dbc,"SELECT * FROM kopi");
while($row=mysqli_fetch_array($tampil)){ ?>
<option value="<?php echo $row['nama']; ?>"><?php echo $row['nama']; ?></option>
<?php } ?>
</select>
</div>
<label>Stok Tersedia : </label>
<input type="text" id="stok" name="stok" placeholder="Stok Tersedia.." readonly><br>
<label>Jumlah : </label>
<input type="text" id="jumlah" name="jumlah" placeholder="Masukkan Jumlah.." required><br>
<label>Harga : </label>
<input type="text" id="harga" name="harga" placeholder="Harga.." readonly><br>
<label>Uang : </label>
<input type="text" id="uang" name="uang" placeholder="Masukkan Uang.." required><br>
<div class="card-button">
<input type="submit" name="submit" value="Lanjutkan" class="simpan">
<input type="reset" name="reset" value="Reset" class="reset">
</div>
</form>
</div>
</div>
<script src="jquery-1.11.3.min.js"></script>
</body>
</html>