Postingan lainnya
Bagaimana cara mengirimkan inputan form kedalam modal bootsrap menggunakan button type=button
<body>
<form>
<label for="inputCode">Kode Barang</label>
<select id="tbCategori" name="tbCategori" class="form-control">
<option selected>pilih..</option>
<?php
$isi = mysqli_query($conn,"Select KATEGORI from barang");
while ($tbkode = $isi->fetch_assoc())
{?>
<option selected><?php echo $tbkode["KATEGORI"]?></option>
<?php }?>
</select>
<button type="button" class="btn btn-dark text-white" name="btcek" data-toggle="modal" data-target="#modalbarang" >Cek</button>
</form>
<!--modal-->
<div id="modalbarang" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body pag scroll" >
<table class="table table-striped" style="width: 100%;">
<thead>
<tr>
<th scope="col">Kode</th>
<th scope="col">Category</th>
<th scope="col">Name</th>
<th scope="col">Variant</th>
<th scope="col">Qty</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
<?php
if(isset($_POST['btcek'])){
$kategori =$_POST['tbCategori'];
}
$sql = 'SELECT * FROM barang where KATEGORI ="'.$kategori.'"';
$query = mysqli_query($conn, $sql);
while ($row = $query->fetch_assoc())
{
?>
<tr>
<td><?php echo $row['ID_BARANG'];?></td>
<td><?php echo $row['KATEGORI'];?></td>
<td><?php echo $row['NAMA_BARANG'];?></td>
<td><?php echo $row['VARIANT'];?></td>
<td><?php echo $row['QTY'];?></td>
<td><?php echo $row['HARGA'];?></td>
</td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--end modal-->
</body>
Tanggapan
Halo, bisa diperjelas lagi apa yang mau ditanyakan?
1 Jawaban:
<div>Kalo saya dapet kasus seperti ini sih saya langsung lari ke jQuery mas, karna button yang mas pake bukan type submit melainkan type button, mungkin maksud masnya adalah "Upload file tanpa refresh page?"</div>