I've been looking for examples of this but haven't found one that's clear to me.
I have a simple array of arrays:
$race = array(
"race1" => array("Date 1", "Town 1"),
"race2" => array("Date 2", "Town 2")
);
I want a foreach loop that will yield the key and a specific value for a dropdown menu:
So if I wanted to pull out "race1, Town 1" and "race2, Town 2" how do I do that? I know it's got to be simple but I can't find it. I'm playing with array_keys($race) as $row which gets me the key but I have no idea how to get the specific value. I tried using that key to just call it from the array but my syntax must have been wrong; I used $race['$row'][1].
I have a simple array of arrays:
$race = array(
"race1" => array("Date 1", "Town 1"),
"race2" => array("Date 2", "Town 2")
);
I want a foreach loop that will yield the key and a specific value for a dropdown menu:
Code:
<option value="race1">Town 1</option> <option value="race2">Town 2</option>
Comment