1

I am trying to insert data in a table using this type of dynamic form:

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

How to submit this form to insert data into a table?

ArKeoLoGeN
  • 11
  • 2
  • `INSERT` cannot have a `WHERE` clause. Are you trying to update existing rows? – Jack O'Neill Mar 17 '19 at 12:44
  • thanks for the reply. I can't solve the problem, and I am not trying to update existing rows but insert. Can't insert data from $_post array. please help. – ArKeoLoGeN Mar 17 '19 at 15:58

0 Answers0