Roger
Roger

Reputation: 165

Array inside of array in HTML to PHP

Is it possible to create a structure like this on HTML ?

Companies-> (employee, payment, etc....); (employee, payment, etc....)

I know that I can create arrays in HTML to use them in PHP through POST... but is it possible to create an array inside of an array ?

And is it correct or there is a better way os of doing that ?

I am guessing that it would be something like this...:

<input name="Companies[employee[]]"/>
<input name="Companies[payment[]]"/>

PS: I can't use 2 diffent IDs or names because it's the User who decides how many entries the form will have.

Upvotes: 0

Views: 111

Answers (1)

Suresh
Suresh

Reputation: 923

Update your code as below.

<input name="Companies[employee][]"/>
<input name="Companies[payment][]"/>

Upvotes: 2

Related Questions