I can get a left menu working on one page and on other page I can get the top menu working but I can’t get these menus working on a single page.
How do I go about having these menus on same page?
Top menu url
http://www.melbtrip.com/cms07/hello2.php
Left menu
http://www.melbtrip.com/cms07/hello3.php?id=1
Here code for my databases
CREATE TABLE Subjects(
id INT(11) NOT NULL AUTO_INCREMENT,
title VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE Pages(
id INT NOT NULL AUTO_INCREMENT,
subjects_id INT(11),
title VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
PRIMARY KEY(id)
);
Top menu code
<?php
include 'database';
include 'database';
// if no id is specified, list the available articles
{
$self = $_SERVERPHP_SELF;
$query = "SELECT id, title FROM Subjects ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
// create the article list
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($id, $title) = $row;
$page .= "<a href="$self?id=$id">$titlern";
}
$title = 'Available Articles';
}
if(!isset($_GETid))
{
$query = "SELECT id, title, content ".
"FROM Subjects ".
"WHERE id = '1'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $title, $content) = mysql_fetch_array($result, MYSQL_NUM);
}
else{
$query = "SELECT id, title, content ".
"FROM Subjects ".
"WHERE id = '{$_GETid}'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $title, $content) = mysql_fetch_array($result, MYSQL_NUM);
}
include ' close database';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/x html1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtm l" lang="EN" xml:lang="EN">
<head>
<link rel="stylesheet" href="css/main.css" type="text/css" />
<title>Allan Close</title>
</head>
<div id="header">
<div id="sitename">
<h1>Matthew Close </h1>
<h2>www.matthewclose.com.au< /h2>
</div>
</div>
<div id="mainNav">
<ul>
<li id="home"><?php echo $page;
// when displaying an article show a link
// to see the article list
?></li>
</ul>
</div>
<div id="left">
<?php
echo $page1;
// when displaying an article show a link
// to see the article list
?>
</div>
<div id="centre1">
<?php
echo $content;
// when displaying an article show a link
// to see the article list
?>
<br />
<br />
<br />
</div>
<div id="footer"> By matthew close</div>
</body>
</html>
left Menu
<?php
include 'library/config.php';
include 'library/opendb.php';
{
$self = $_SERVERPHP_SELF;
$query = "SELECT id, title FROM Pages ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
// create the article list
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($id, $title) = $row;
$page1 .= "<a href="$self?id=$id">$titlern";
}
$title = 'Available Articles';
}
$query = "SELECT id, title, content ".
"FROM Pages ".
"WHERE id = '{$_GETid}'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $title, $content) = mysql_fetch_array($result, MYSQL_NUM);
include ' close database';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/x html1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtm l" lang="EN" xml:lang="EN">
<head>
<link rel="stylesheet" href="css/main.css" type="text/css" />
<title>Allan Close</title>
</head>
<div id="header">
<div id="sitename">
<h1>Matthew Close </h1>
<h2>www.matthewclose.com.au< /h2>
</div>
</div>
<div id="mainNav">
<ul>
<li id="home"></li>
</ul>
</div>
<div id="left">
<?php
echo $page1;
// when displaying an article show a link
// to see the article list
?>
</div>
<div id="centre1">
<?php
echo $content;
// when displaying an article show a link
// to see the article list
?>
<br />
<br />
<br />
</div>
<div id="footer"> By matthew close</div>
</body>
</html>
Thank you
from Matthew