如何在表中插入多个数据

时间:2019-03-17 10:48:32

标签: php mysql

我正在尝试使用这种动态形式在表中插入数据:

userfood_order.php

<form name="frmUser" method="post" action="mainfiles/user_order.php">

<?php

$result = mysqli_query($con, "SELECT * FROM items where deleted = 0");
while($row = mysqli_fetch_array($result)) {
    echo '<tr><td><ran1 value="'.$row["name"].'"name="'.$row["name"].'">'.
        $row["name"].'</ran1></td><td><ran2 name ="'.$row["id"].'_price">Rs.&nbsp;'.$row["price"].
        '</ran2></td>';
    echo '<td><label for='.$row["id"].' class=""></label>';
    //echo '<input style="width: 100px" id="'.$row["id"].'_quantity" name="'.$row['id'].'_quantity" type="text" ></td></tr>';
    echo '<input id="'.$row["id"].'_quantity" name="quantity[]" type="text" </td>';
    echo '<td><input value="'.$row["name"].'" id="'.$row["id"].'_name" name="name[]" type="hidden" </td>';
    echo '<td><input value="'.$row["price"].'" id="'.$row["id"].'_price" name="price[]" type="hidden" </td>';             
}

?>

enter image description here

enter image description here

如何提交此表单以将数据插入表中?

0 个答案:

没有答案