Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

this was the form that i made in my php

<form>
<table>
<tr>
<td><div align="left">Jenis Document</div></td>
<td><input type="text" id="jnsdcm" value="BC 2.3"></input></td></tr>
<tr>
<td><div align="left">Dokumen Pabean</div></td>
<td>Nomor: <div align="left"><input id="nomor" type="text"></input></div> Tanggal :<div align="left"><input id="tanggal" type="text"></input></div></td>
</tr>
<tr>
<td><div align="left">Pemasok/Pengirim</div></td>
<td><select id="supplier">
     <option selected = "selected" >-Pemasok/Pengirim-</option>
            <?php
            $q = mssql_query("SELECT DISTINCT SupplierName from vwOutstandingNPBB"); 

            while ($r = mssql_fetch_array($q)){
            echo "<option value='$r[SupplierName]'>$r[SupplierName]</option>";
        }?>
        </select>
    </td>
</tr>
<tr>
<td><div align="left">Barang</div></td>
<td><input type="text" id="barang"><input type="button" id="nmbarang" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this})" value="Tambah Nama Barang"></button></td>
</tr>
<tr><td colspan="2"><input type="button" value="Save" id="save"><input type="reset" value="Cancel" id="reset"></td></tr>
</table>
</form>

On "Barang", filled by checked data of submitted multiple checkbox input data. I have problem to submitted checked data to that field. here the code of multiple checkbox data

<?php
include 'config/koneksi.php';?>
<form method='POST'>
    <table>
        <tr>
            <th bgcolor="#1E90FF"><div align='center'>Pilih</div></th>
            <th bgcolor="#1E90FF"> <div align='center'><b>Kode Barang</div></b></th>
            <th bgcolor="#1E90FF"> <div align='center'><b>Nama barang</div></b></th>
            <th bgcolor="#1E90FF"> <div align='center'><b>Sat</div></b></th>
            <th bgcolor="#1E90FF"> <div align='center'><b>Jumlah</div></b></th>
            <th bgcolor="#1E90FF"> <div align='center'><b>Nilai Barang</div></b></th>
        </tr>
<?php $nama = $_POST['supplier'];
$id = mssql_query("SELECT TOP 20 * ,(QntyBuy*UnitPrice) as Total FROM vwOutstandingNPBB WHERE SupplierName = '$nama'");
while($k = mssql_fetch_array($id)){
$total = number_format($k['Total'],2,',','.');
echo"
        <tr>
            <td><input name='ItemID[]' type='checkbox' value= '".$k['ItemID']."'></td>
            <td>$k[ItemID]</td>
            <td>$k[ItemName]</td>
            <td>$k[PurchaseUOMName]</td>
            <td> $k[QntyBuy]</td>
            <td>$k[CurrencyID]&nbsp; $total</td>
        ";}
    echo"</table>";
    echo"</tr><br><input type='submit' value='Add'></br></table></form>";
?>
share|improve this question
Do you know how to SELECT, INSERT in PHP yet? I will answer differently based on your knowledge. – invisal Jul 20 at 9:45
Don't recommend w3schools.com as a reference. It's full of errors, see w3fools.com – Marcel Korpel Jul 20 at 9:49
i know that basic sql. my problem in making pop-up for diplaying item, submitted value which checked and proses in insert data which 3 field same data in last have many data – Andriansyah Andri Jul 20 at 9:52
i have editted my question..hope the prbolem will clear – Andriansyah Andri 17 hours ago

put on hold as unclear what you're asking by DevZer0, Marcel Korpel, Andreas Köberle, burzum, Graviton yesterday

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

This is HTML form part

<form method='POST'>
    <table>
        <tr>
            <td style='width:40px;'></td>
            <td style='width:100px;'><b>No Invoice</b></td>
            <td style='width:100px;'><b>Date</b></td>
            <td style='width:100px;'><b>Amount</b></td>
        </tr>
        <?php 
            // Select list of invoice from your database
            // ....
            // ....

            while ($row = mysql_fetch_row($result)) {
        ?>
        <tr>
            <td><input name='invoice_id[]' type='checkbox' value='<?php echo $row['invoice_id']; ?>'></td>
            <td><?php echo $row['invoice_code']; ?></td>
            <td><?php echo $row['invoice_date']; ?></td>
            <td><?php echo $row['invoice_amount']; ?></td>
        </tr>
        <?php } ?>
    </table><br>
    <input type='submit' value='Add'>
</form>

The PHP part

if (isset($_POST['invoice_id'])) {
    foreach($_POST['invoice_id'] as $value) {
        // $value = a selected invoice id
        // you can use SQL to insert to any table you want.
    }
}
share|improve this answer
i have editted my question. hope you can help me – Andriansyah Andri 15 hours ago

Not the answer you're looking for? Browse other questions tagged or ask your own question.