Multi Dimensional Array in Form from check boxes
Posted on 2005-03-02
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 ?