HTML: table of forms?

后端 未结 2 695
面向向阳花
面向向阳花 2020-12-17 02:10

I frequently find myself wanting to make a table of forms -- a bunch of rows, each row being a separate form with its own fields and submit button. For instance, here\'s an

2条回答
  •  难免孤独
    2020-12-17 02:33

    The trick here is to just use a single form, e.g.

        

    Say you have a product snake with id 6. You then name the input for that item's quantity field quantity[6].

    I don't know what server side language you are using, but in PHP you can then iterate over the quantites and update based on the ID. You'd get an array like this:

    $_POST['quantity'] = array(
        '6' => 4
    )
    

提交回复
热议问题