I need to use elements in an individual element in an associative array and I do not have the key value. The array is HTTP_POST_VARS which was populated with an HTML form that is organized as a table. Data for the form comes from an SQL query which will yield some variable number of rows. The form field names I'm interested in contain an identifier which renders them unique and corresponds to their row in the form.
My problem is that I do not know how to reference the elements in the array directly - via a numeric index. Could someone please explain?
the statement: print_r(array_keys($formdata));
yields the following results:
Array ( [0] => numResults [1] => checkbox1 [2] => ID1 [3] => ID2 [4] => ID3 [5] => ID4 [6] => Submit )
the statement: print_r(array_values($formdata)): yields the following:
Array ( [0] => 4 [1] => checkbox [2] => 3 [3] => 3 [4] => 4 [5] => 7 [6] => Connect User )
The pair 'checkbox1'=> 'checkbox' indicates that this box was checked and that the user wants to do something with the data in row 1 of the table. What I now need is the value assciated with the key named "ID1" (the value is 3) because it is in the same row as the checked checkbox.