数组内的多个文本框

时间:2019-04-01 08:13:41

标签: php mysql

我一直在尝试从文本框中更新mysql中的值

<?php  
$ses_sqlc = ("select * from checks where orderid='".$id."' ");
$resultc = $conn->query($ses_sqlc);
$num_ros = $resultc->num_rows;
while ($rowcc = $resultc->fetch_assoc())
{
?>   
    <tr>
        <td><?php echo $rowcc['name']; ?></td> 
        <td class="replyBTN">
            <h6 style="color:#000000; cursor:pointer" >+Serial No.</h6>
        </td>
        <td class="appnd" style="display:none;">Enter Serial Nos.
            <table>
                <tr>
                <?php for ($j=0; $j < $rowcc['valuess']; $j++) { ?>
                    <td style="padding-left:5px;">
                        <input type="hidden" value="<?php echo $rowcc['id']; ?>" name="checkid[]" />
                        <input type="text" name="valsno[]" class="form-control" placeholder="1">
                    </td>

                <?php } ?>
                </tr>
            </table>
        </td>

        <td><?php echo $rowcc['valuess']; ?></td> 
        <td><?php echo $rowcc['remarks']; ?></td>
        <td><input name="midlevelusers[]" id="list11" class="age_agree" type="checkbox"></td>
    </tr>             

    <?php if (isset($_POST['checkid'])) {
        $item_idCount = count($_POST["checkid"]);
        for ($i = 0; $i < $item_idCount; $i++) {

        $valsno = implode(',', $_POST['valsno']);

        $conn->query("UPDATE checks set snos='" . $valsno[$i] . "' WHERE id ='" . $_POST["checkid"][$i] . "'");
        }
    // sno ends
    }

下面是我到目前为止尝试过的代码。

但是它不能正确更新行

有什么建议会有所帮助吗?

0 个答案:

没有答案