Link to home
Start Free TrialLog in
Avatar of Delacourt
DelacourtFlag for South Africa

asked on

Multi Dimensional Array in Form from check boxes

Hi,

I have a form setup to use check boxes.
On this form I have an array text input for a persons name
<input name=\"contact_name[]\" type=\"text\">
The I have a list of some checkboxes dynamically created from the db, say five options:
<input type=\"checkbox\" name=\"favourite_food[]\" value=\"$result[food_id]\">$result[food_name]

I want to then print the persons name, and then the food s/he likes, according to what was ticked

At the moment It is printing the persons name, then all foods that were ticked, not just the foods that are relative to each specific person.

Basically, I dont know how I need to index the above arrays so that they foods belong to one person, and how would i do the foreach for this ?
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial