Forms with a variable number of fields

后端 未结 3 982
情书的邮戳
情书的邮戳 2020-12-18 08:34

I\'m attempting to create a sort of marketplace. Each item on the market has a type (i.e. the item being sold), a value, a quantity, a seller name, and an id, and all of thi

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 09:27

    To expand on what @Michael has said in his comment, you need to turn the name='id' into an array, like this (PHP):

    echo ''

    Where $i is incremented every loop.

    When the form is posted, you can access this array like this:

    $_POST['id']['1']

    Replacing ['1'] with whatever you want.

提交回复
热议问题