Web Dinamis

Web dinamis
Masuk ke local host tidk bisa langsung dijalankan dari
Foldernya langsung
file:///D:/xamp/htdocs/WebDinamis/index.php => tidak bisa
http://localhost:8080/WebDinamis/index.php => bisa untuk web dinamis


home.php


<html>
<head>
<title>Web Dinamis</title>
<style>
*{
padding:0;
margin:0;
}
a{
text-decoration:none;
}
li{
list-style:none;
}
#menu{
width:1000px;
height:50px;
background:blue;
}
#menu li{
display:inline-block;
width:100px;
background:red;
height:50px;
line-height:50px;
text-align:center;
pointer:mouse;
}
#menu li:hover{
background:white;
}
#menu li:hover #subMenu{
display:block;

position:absolute;
}
#subMenu{
display:none;
}
#subMenu li{
display:block;
}
#content{
top :900px;

margin-top:70px;
}
</style>

</head>
<body>
<nav id="menu">
<ul>
<li><a href="index.php?halaman=a">A
<nav id="subMenu">
<ul>
<a href="index.php?halaman=a"><li>A1</li></a>
<a href="index.php?halaman=a"><li>A2</li></a>
<a href="index.php?halaman=a"><li>A3</li></a>
</ul>
</nav>
</li>
<a href="index.php?halaman=b"><li>B</li></a>
<a href="index.php?halaman=c"><li>C</li></a>
<a href="index.php"><li>Home</li></a>
</ul>
</nav>
<div id="content">
<?php
if(isset($_GET['halaman'])){
$pages=$_GET['halaman'];
switch($pages){
case 'a':
include "hal/a.php";
break;
case 'b':
include "hal/b.php";
break;
case'c';
include"hal/c.php";
break;
default:
echo "<center><h1>Data Not Found</h1></center>";
}
}
else{
echo'Home';
}

?>

</div>
</body>
</html>

buat folder hal
simpan kode berikut

a.php

<h1>A</h1>

b.php
<h1>B</h1>

c.php
<h1>C</h1>









Web Dinamis Web Dinamis Reviewed by Leo on 18:23 Rating: 5

No comments