2014-03-02 27 views
0

我有一個動態的HTML表單,可以用JavaScript爲一些產品創建新的輸入,並且每個產品都有更多的顏色。如何使用HTML表單POST POST關係數據

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

如何創建這個網站的代碼,這樣,當我在後有他們,我可以用一個爲它們關聯。

回答

1

像這樣做:

<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][]"> 
+0

+0

它正是我想要的,謝謝! –