Skip to main content

PHP#5 $_GET - click vào Menu, hiện ra nội dung tại Main

 //index

<!doctype html>

<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
#container{width: 900px; margin: auto; border: 1px solid #2752C7;}
#header{height: 100px; border-bottom: 1px solid #2752C7;}
#left{width: 200px; float: left; border-right: 1px solid #2752C7; min-height: 300px;}
#right{float: right; width: 697px; min-height: 300px;}
#footer{height: 50px; clear: both; border-top:1px solid #2752C7; }

</style>
</head>

<body>
<div id="container">
<div id="header"><?php include("header.php");?></div>
<div id="left"><?php include("menu.php");?></div>
<div id="right">
<?php
if(isset($_GET['key']))
{
switch($_GET['key'])
{
case "tt": include("tintuc.php");break;
case "xh": include("xahoi.php");break;
}
}
else include("main.php");
?>
</div>
<div id="footer">Footer</div>

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

//header.php
<p>Đây là banner</p>

//menu.php
<p><a href="index.php">Trang chủ</a></p>
<p><a href="index.php?key=tt">Tin tức</a></p>
<p><a href="index.php?key=xh">Xã hội</a></p>
<p>Giải trí</p>

//main.php
<p>Đây là trang main
</p>
<p>&nbsp;</p>
<p>Mặc định sẽ hiển thị nội dung của trang main.php.</p>
<p>Khi người dùng click vào mục nào (ở menu bên trái) thì nội dung tương ứng (nội dung của trang tương ứng) sẽ hiện ra.</p>

//tintuc.php
<p>Đây là trang tin tức!</p>
<p>&nbsp;</p>

//xahoi.php
<p>Đây là trang xã hội!</p>
<p>&nbsp;</p>

Comments

Popular posts from this blog

PHP#33MySQL#29 - Đếm lượt truy cập (KẾT THÚC KHÓA HỌC)

//hitcounter.php <?php session_start();  ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php  include("../connect.php"); //cập nhật số luowhtj truy cập: $sl="update counter set cnt=cnt+1"; mysqli_query($link,$sl); //Lấy dữ liệu số lượt truy cập để hiển thị ra web: $sl2="select * from counter"; $kq=mysqli_query($link,$sl2); $d=mysqli_fetch_array($kq); //Định dạng: $chuoi=str_pad($d['cnt'],6,"0",STR_PAD_LEFT); $luottrycap=""; for($i=0;$i<strlen($chuoi);$i++) { $tam=substr($chuoi,$i,1); $luottrycap.="<img src='images/$tam.png'/>"; } /*-Khi user truy cập vào website: +lần đầu tuy cập: Lưu thông tin của user lên csdl +Sau lần đầu tiên: cập nhtaaj lastvisit - Xóa các dòng dữ liệu quá 1 phút (Quy ước thời gian để khẳng định online hay offline: 1 phút) - Thống kê số liệu người dùng o...

2 (giao diện Visual C#) Solution Explorer

Bài 2 - SOME OTHER TIME - Vào dịp khác