Log in

View Full Version : Dynamic Page Content



dmiller
08-01-2011, 02:45 PM
Good Morning All,

I know there is an AJAX version of what I am trying to do , but I would also like to know the PHP version. Could someone review my code and tell me why I am getting a parsing error, please? The parsing error is reported at the closing body tag of the page. Thanks




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP content Change </title>
<style type="text/css">
li {
list-style-type: none;
display: inline;
margin-right: 15px;
}
</style>
</head>

<body>
<img src="http://www.grass-rootsfoundation.org/images/grass4_r1_c1.jpg" width="980" height="114" />
<h1>ABOUT US</h1>
<ul>
<li><a href="contentchange.php?link=1">President</a></li>
<li><a href="contentchange.php?link=2">Staff</a></li>
<li><a href="contentchange.php?link=3">Board of Directors</a></li>
</ul>
<?php
if (isset($_REQUEST['link'])) {
$link = $_REQUEST['link'];}
else {$link = 1;}
switch ($link) {
case 1:
include ("aboutroots.html");
break;
case 2:
include ("rootsstaff.html");
break;
case 3:
include ("rootsdirectors.html");
break;
default:
$link = 1;
break;
?>
</body>
</html>

JShor
08-01-2011, 04:50 PM
You didn't close your switch().

This should work:


if (isset($_REQUEST['link'])) {
$link = $_REQUEST['link'];}
else {$link = 1;}
switch ($link) {
case 1:
include ("aboutroots.html");
break;
case 2:
include ("rootsstaff.html");
break;
case 3:
include ("rootsdirectors.html");
break;
default:
$link = 1;
break;
}