<table class="table table-hover datatable" style="width: 100%" id="tabelku">
<thead>
<tr>
    <th>Kode Barang</th>
    <th>Barcode</th>
    <th>Nama Barang</th>
    <th>Stok Tersedia</th>
    <th>Jumlah Permintaan</th>
    <th>Satuan</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach ($databarang as $hasil) {
    ?>
    <tr>
        <td>
            <?php echo $hasil->kode_barang ?>
            <input type="hidden" value="<?php echo $hasil->kode_barang ?>" name="kdb[]" id="kdb<?php echo $i ?>"> 
        </td>
        <td><?php echo $hasil->barcode ?></td>
        <td><?php echo $hasil->barang ?></td>
        <td><?php echo $hasil->stok ?></td>
        <td>
            <input type="number" value="<?php echo @$arrminta[$hasil->kode_barang] ?>" name="minta[]" id="minta<?php echo $i ?>" class="form-control">
        </td>
        <td>
            <select name="satuan[]" id="satuan<?php echo $i ?>" class="form-control">
                <?php
                if (@$arrsatuan[$hasil->kode_barang]) {
                    foreach ($arrsatuan[$hasil->kode_barang] as $key => $value) {
                        ?>
                        <option value="<?php echo $value ?>"><?php echo $value ?></option>
                        <?php
                    }
                }
                ?>
            </select>
        </td>
    </tr>
    <?php
    $i++;
}
?>
</tbody>
</table>