Leakbali
w3 Tutorial, Web Tutorial
Switch to English Bahasa Indonesia 
Register   Login

Source Code  


Share

Create Menu With PHP Associative Array 

To create many links / menu with a few code, we can looping it from array data. First, we hold the link and also it text into associative array. Here is the simple code:
<html>
<head>
<title>Create Menu with PHP Associative Array</title>
</head>
<body>
<h2>Create Menu with PHP Associative Array</h2>
<ul>
<?php
//create php asociative array hold in $a variable (as example we create 4 menu : Home, Profile, Gallery, Guestbook)
$a = array("index.php"=>"Home", "index.php?pg=profile"=>"Profile", "index.php?pg=gallery"=>"Gallery", "index.php?pg=guestbook"=>"Guestbook");
//loop data
foreach($a as $link=>$text){
//print links
echo "<li><a href='".$link."'>".$text."</a></li>";
}
?>
</ul>
</body>
</html>
Download
Post by : Oka Dayendra
Post on : 24 July 2011
File : menu-with-php-associative-array.zip, size : 519 bytes
Title : Create Menu With PHP Associative Array
Category : PHP
Source : http://www.leakbali.com
Comment (0)
Name *
Email *
Website
example : http://www.google.com or http://www.yourname.com
Comment *
Security Code *

Related Articles

Source Code


References

About Us

Home
About Us
Contact Us
Sitemap

Tools

Google PageRank
Alexa Rank
Keywords Density

Accounts

Register Account
Login
Valid XHTML 1.0 TransitionalValid CSS!
Web Directory


2006 - 2012 © Leakbali.com - Free Web Tutorial, Free Web Articles, Web Sharing, Source Codes, Web References