I have two arrays, let's say
$aryIDs
$aryValues
I want to run through each array to generate an html form select menu. If i was just using one array I would do something like this:
foreach ($aryValues as $optValues)
{
$strOutput .= "<option>$optVaules</option>";
}
When I run through two arrays I always end up using a while loop. So let's say I wanted the value of the option to be the id, I would do something like:
$intMax = count($aryIDs);
$intCount = 0;
while ($intCount < $intMax)
{
$strOutput .= "<option value=\"$aryIDs[$intCount]\">$aryValues[$intCount]</option>";
$intCount++;
}
I'd like to eliminate the while loops if possible because I think the foreach command is a little cleaner. So if there's a way to run through two arrays without using a while loop, please advise. Thanks!