Pergunta

I have a dynamic html form that creates with javascript new inputs for some products and each product has more colors.

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

How do i create this html code so that when i have them in the post i could relate them with a for.

Foi útil?

Solução

do it like this:

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

or :

<input type="text name="products[product_index]">
<input type="text name="[colors][product_index][]">
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top