Submit html table data with via form (post)

前端 未结 4 388
不思量自难忘°
不思量自难忘° 2020-12-29 14:27

I want to post this html table on submit button click.

01 - I want to retrieve the data of this table in php code (server side) 02 - I also want to display this tabl

4条回答
  •  隐瞒了意图╮
    2020-12-29 14:37

    Since you are trying to submit multiple rows of inputs/selects with the same 'name' attribute to a backend, you would need to add square brackets [] to the end of the name value in those inputs (in the table rows).

    This tells your browser to create an array for that name property.

    In php, read it as $_POST['color_1'][0] and $_POST['color_2'][0], and loop as you'd like.

    The brackets are in Phil Bailey's answer, but they are not pointed out. (Added because a recent search led me to this)

    提交回复
    热议问题