Get the values of 2 HTML input tags having the same name using PHP

后端 未结 4 1662
旧时难觅i
旧时难觅i 2021-01-21 00:41

Suppose I have the following table:

4条回答
  •  醉话见心
    2021-01-21 01:14

    When PHP populates $_POST, if multiple pieces of data have the same name, and that name does not end in [] then only one will survive to appear in the $_POST array.

    Rename the fields so the names ends in [].

    don't tell me to change the name of the input tags, because the table is bit more complicated than that and it has dynamic add rows

    Being dynamic shouldn't be a barrier to having [] on the end of the name.

    If you really can't change the name then it might be possible to bypass $_POST entirely and parse the raw data (via php://input) but IIRC, PHP clobbers that when it populates $_POST.

提交回复
热议问题