INSIDE
<Div id="****"> <?php include("filename.php");?> </div>
In header.php
<?php
echo '<div id="header">
ONLINE LIBRARY SYSTEM
</div>';
?>
To call header,php we use syntax: <?php include("header.php");?>
In footer.php
<?php
echo '
Copyright © 2012 <a href="index.html">AcademiaInternational.com</a>
';
?>
To call footer,php we use syntax: <?php include("footer.php");?>
In logout.php
<?php
session_start();
if(isset($_SESSION['login_id']))
unset($_SESSION['login_id']);
header( 'Location: http://localhost/webtech/july15/examples/login.php' ) ;
?>
To call logout,php we use syntax <?php include("logout.php");?>
<head>
<title>Library Management System</title>
<link type="text/css" rel="stylesheet" href="style.css"/> // to link stylesheet
</head>
<body onload = "">
<div id="wrapper">
<div id="header">
<?php include("header.php");?> //as defined above,header,php contains data...
</div>
<div id="container">
<div id="lcontain">
<?php include("menu.php");?> //as defined above,menu,php contains data..
</div>
<div id = "rcontain">
<?php
if(isset($_SESSION['login_id'])){
$con = mysql_connect("localhost","root",""); //connect with local server(apache)
if (!$con){
die('Could not connect: ' . mysql_error());
}
// Select database
mysql_select_db("online_library", $con); //connet database with server
/* read data from the database*/
$query = "SELECT * FROM users where login_id = '".$_SESSION['login_id']."'";
$result = mysql_query($query);
mysql_close();
echo('<table id = "displaytable">');
//execute and display the content in array
while($row = mysql_fetch_array($result)) {
$firstname = $row['name'];
$login_id = $row['login_id'];
$address = $row['address'];
echo "<tr>
<td>Name:</td><td>$firstname</td></tr>
<tr><td>Login Id:</td><td>$login_id </td></tr>
<tr><td>Address:</td><td>$address</td></tr>";
}
echo('</table>');
}else
{
echo "you are not allowed to access this page!! please login";
}
?>
</div>
</div>
<div id="footer">
<?php include("footer.php");?>
</div>
</div>
</body>
</html>