I was just throwing together the beginnings of a website on my localhost server -- Apache, MYSQL, MYPHPADMIN. All appeared to be working fine until I attempted to link up the navigation dynamically using $_GET. Here is the code in index.php:
<?php include('Config/setup.php') ?>
<?php
if ($_GET['page'] == ''){
$pg = 'home';
} else {
$pg =$_GET['page'];
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FTS</title>
<link rel="stylesheet" type="text/css" href="css/Styles.css"/>
</head>
<body>
<div class ="header temp_Block">
<?php include('templates/header.php');?>
</div>
<div class ="main_nav temp_Block">
<?php include('templates/main_nav.php');?>
</div>
<div id ="Content">
<div class ="main_content temp_Block ">
<?php
include ('content/'.$pg.'php');
?>
</div>
</div>
<div class = "footer temp_Block">
<?php include('templates/footer.php');?>
</div>
</body>
</html>
When I checked my links to see if I was able to link to my various pages -- home, services, about us etc. Its giving me this error:
Notice: Undefined index: page in C:\xampp\htdocs\test\index.php on line 6
Warning: include(content//content/homephp): failed to open stream:
No such file or directory in C:\xampp\htdocs\test\index.php on line 35
Warning: include(): Failed opening 'content//content/homephp' for inclusion
(include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\test\index.php on line 35
So I ran this to see what was going on with $_GET:
var_dump($_GET);
exit;
The array is empty. IT shows nothing. I've used this method before but the difference was I was on a hosted site. I checked to see if I had permissions problems but I checked apache.conf and nothing appeared to be wrong.