i have this database
and this form, dynamically generated from the database
<table border="1" cellspacing="0" cellpadding="6">
      <tr bgcolor="#CCCCCC">
        <td><strong>product id</strong></td>
        <td><strong>product name</strong></td>
        <td><strong>product price</strong></td>
        <td><strong>quantity</strong></td>
      </tr>
    <form method="post" action="insert.php">
    <?php
        $query = $dbh->query('SELECT * FROM products');
        $results = $query->fetchAll(PDO::FETCH_ASSOC);
        foreach ($results as $row)
        {
    ?>
    <tr>
        <td><?php echo $row['product_id']; ?></td>
        <td><?php echo $row['product_name']; ?></td>
        <td><?php echo $row['product_price']; ?></td>
        <td><input name="quantity" type="text" value="0"></td>
    </tr>
    </form>
    <?php } ?>
    </table>
    <br>
    <input type="submit" value="Add Records">
the quantity in the form is a textbox so i can modify it. I would like to enter the quantities and the pressing the button to insert the values in the order_products table (including the quantity).
1) How can i pass ALL the quantities and product_id (and the rest) to the next page through post? (until now i know how to pass single values)
2) is there a better way to achieve it?
3) the insert statements should be in the same page or the page where i get the post vars?
db scheme https://i.stack.imgur.com/oqdOy.jpg
thanks
Rob
 
     
     
     
    