Bare in mind that it's late where I am so this may just be a very simple solution that I am overlooking.
I have this foreach statement:
<? foreach ($entrees as $entree) { ?>
<li>
<span class="food-name">
<?=$entree['name']?>
</span>
</li>
<?}?>
That gives an Undefined variable error for $entree.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: entree
Filename: views/welcome_message.php
Line Number: 9
I tried print_r($entrees);
and the result was
Array ( [0] => Array ( [name] => Lamb [description] => A small leg of lamb ) [1] => Array ( [name] => Ham [description] => Large thing of ham ) ) 1
Again, this may be something stupid simple but I've been trying to 30 min and can't get it to work for the life of me. Thanks in advance for the help.
You need to set short_open_tag
to On
in php.ini. That fixed it for me with no additional code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With