Reputation: 11471
I have been trying to access the values of the the array .. in the foreach loop but no luck, the first two calls get the values, but the ones in the foreach loop nothing.. comes empty although if i print the array all the values are there.
Upvotes: 1
Views: 83
Reputation: 8819
You never actually access the $dish variable in the foreach loop. Try
$dish['Dish']['dish_name'];
instead of
$dishes['Dish']['dish_name'];
etc.
Additionally, you will get an error because the first element in your array is not a Dish, its a Dish_Category. Thus, either remove this element from the array, or use a simple if statement before you access the $dish such as:
if($dish['dish_name'])
//DO STUFF HERE
Also, there is no reason for so many
<?php ?>
tags. Couldn't you put the whole block of code in one?
Upvotes: 1