Saturday, 24 August 2013

php code isn't executing properly

php code isn't executing properly

I have just written the following code to generate navigational menus, but
it is not executing properly. Can anybody please pinpoint the error? Thank
you.
<?php
$pages = array(
'0' => array('title' => 'Health', 'url' => 'health.php'),
'1' => array('title' => 'Weightl Loss', 'url' => 'weightloss.php'),
'2' => array('title' => 'Fitness', 'url' => 'fitness.php'),
'3' => array('title' => 'Sex', 'url' => 'sex.php'),
'4' => array('title' => 'Mind-Body', 'url' => 'mindbody.php'),
'5' => array('title' => 'Food', 'url' => 'food.php'),
'6' => array('title' => 'Beauty', 'url' => 'beauty.php'),
'7' => array('title' => 'More', 'url' => 'more.php')
);
echo "<div id=\"nav-menu\" style=\"width:65px;\">\n";
// let's create a unordered list to display the items
echo "<ul>";
echo "<li>\n";
// here's where all the items get printed
foreach ($pages as $Listing) {
echo "<a href='".[$Listing]["url"]."'>".[$Listing]["title"]."</a>\n";
}
echo "</li>\n";
// closing the unordered list
echo "</ul>";
echo "</div>\n";
?>

No comments:

Post a Comment