<?php
define("TITLE", "Menu Item | Risque");
include('includes/header.php');
$menuItem = '';
$dish = '';
if (isset($_GET['item'])) {
$menuItem = $_GET['item'];
$dish = $menuItems[$menuItem];
}
function suggestedTip ($price, $tip){
$totalTip = $price * $tip;
}
?>
<center><img src = "hr.png">
<br>
<div id = "dish">
<h1><?php $dish = array(); echo $dish["title"]; ?> <span class="price"><sup>$</sup><?php echo $dish["price"]; ?></span></h1>
<p><?php echo $dish["blurb"]; ?></p>
<br>
<p><strong>Suggested beverage: <?php echo $dish["drink"]; ?></strong></p>
<p><em>Suggested tip: <sup>$</sup><?php suggestedTip($dish["price"], 0.20); ?></em></p>
</div>
arrays.php codes are below somehow the values inside the array does not show up in my page
<?php
$navItems = array (
array(
'slug' => "index.php",
'title' => "Home"
),
array(
'slug' => "menu.php",
'title' => "Menu"
),
array(
'slug' => "contact.php",
'title' => "Contact"
),
);
$menuItems = array(
"club-sandwich" => array(
"name" => "Club Sandwich",
"price" => 11,
"blurb" => "Bacon ipsum dolor sit amet fatback landjaeger ullamco pariatur. Nostrud laboris et, duis drumstick eiusmod kevin ut aliquip. Filet mignon short ribs tenderloin short loin kielbasa non pork chop aliqua. Jerky shank tri-tip capicola, non andouille tenderloin cupidatat turducken meatball pork beef eu shoulder jowl.",
"drink" => "Club Soda"
),
"dill-salmon" => array(
"name" => "Lemon & Dill Salmon",
"price" => 18,
"blurb" => "Pork belly tempor ground round qui exercitation, jowl leberkas sed voluptate excepteur jerky. Reprehenderit veniam cow, quis in ribeye andouille eu pastrami eiusmod exercitation dolor.",
"drink" => "Fancy Wine"
),
"super-salad" => array(
"name" => "The Super Salad<sup>®</sup>",
"price" => 34,
"blurb" => "Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.",
"drink" => "Jug o' Water"
),
"mexican-barbacoa" => array(
"name" => "Mexican Barbacoa",
"price" => 23,
"blurb" => "I love fruitcake danish caramels. Tart danish pastry liquorice chocolate cake fruitcake. Bear claw gingerbread muffin I love apple pie apple pie tiramisu brownie chocolate. Sweet roll cotton candy cupcake gingerbread gummies jelly-o. Muffin I love croissant I love jelly-o brownie jelly beans. Toffee I love pastry.",
"drink" => "Beer with a lime"
),
);
?>
I am new to PHP but I have a project that is due soon but I keep getting undefined error for title
, price
and blurb
.
I would appreciate it if anyone can help.