如何使用 html 表单发布关系数据



我有一个动态的html表单,它使用javascript为某些产品创建新的输入,并且每个产品都有更多的颜色。

<input type="text name="products[]">
<input type="text name="colors[]">

我如何创建此 html 代码,以便当我将它们放在帖子中时,我可以将它们与 for 联系起来。

这样做

<input type="text name="products[product_index][name]">
<input type="text name="products[product_index][colors][]">

或:

<input type="text name="products[product_index]">
<input type="text name="[colors][product_index][]">

最新更新