Home › Forums › Back End › Turn PHP into CSS Drop Box › Reply To: Turn PHP into CSS Drop Box
July 5, 2015 at 4:30 am
#204589
Participant
As @traq mentioned above, show us the data contained within $genres
.
But in general, PHP foreach loop:
$numbers = array(1,2,3,4,5);
foreach( $numbers as $number ) {
echo $number;
};
/*
Result:
12345
*/
$associates = array(
'president' => 'Jane Doe',
'assistant' => 'Joe Blow',
);
foreach($associates as $role => $name) {
echo $name . ', ' . $role . '<br/>';
};
/*
Result:
Jane Doe, president
Joe Blow, assistant
*/
You can test your code online using http://viper-7.com/8owHD2
Hope that helps.