I have a form that has fixed fields as well as dynamic fields created from a database. the fields could be different every time and they are dropdowns with options like color size etc.I could name the dropdowns like this:
name="options[]"
and then do something like:
foreach($options as $option) {
//add to db
}
however that only gives me the values and I need to know the optionID as well
I could do somethign like:
name="<? echo $optionID; ?>"
for the dropdown but I don’t know what optionID’s were included in the form when I try to process the submitted data. how do I pass both the optionID and it’s selected value when adding fields to a form dynammically?
You can make the array multidimensional. Something like this might work for you: