I'm trying to build a drop-down from 2 arrays, and I've got the options working but the nested foreach loop is not working, so each option in the drop down has the same title (first item of array $linkText). What is the correct way of doing this? Thanks.
$content.='<select onChange="window.location.href=this.value">';
$content.=' <option selected="selected">Choose one</option>';
foreach($dateLinks as $item1){
$content.='<option value="'.$item1.'">';
foreach($linkText as $item2){
$content.=' '.$item2.' </option>';
}
}
$content.='</select> ';
The arrays look like this:
$dateLinks = array(
'/latest/potm/previousmonths/Oct2003',
'/latest/potm/previousmonths/Nov2003',
'/latest/potm/previousmonths/Dec2003',
'/latest/potm/previousmonths/Jan2004'
);
$linkText = array('Oct2003', 'Nov2003', 'Dec2003', 'Jan2004');