danny causer
New member
Hi, I am trying to make my first dynamic site using php. I am however getting the following error message on my first page:
_______________________________________________________
My first Page
home
tutorials
Notice: Undefined index: page in C:\wamp\www\test\index.php on line 18
welcome to my website
______________________________________________________
my tutorial link works and doesnt display the error. but my index page makes this come up. my code is as follows (I have typed in line 18 for this example, but i dont have it on my actual script)
_______________________________________________________
<!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>My First Page</title>
</head>
<body>
<h1>My first Page</h1>
<a href="index.php">home</a><br />
<a href="index.php?page=tutorials">tutorials</a><br />
<?php
LINE 18!!!!! $page = $_GET['page'];
if ($page)
{
include ("content/".$page.".php");
}
else
{
echo "welcome to my website";
}
?>
</body>
</html>
______________________________________________________
Please help if you can, Im using dreamweaver, wamp and firefox!
_______________________________________________________
My first Page
home
tutorials
Notice: Undefined index: page in C:\wamp\www\test\index.php on line 18
welcome to my website
______________________________________________________
my tutorial link works and doesnt display the error. but my index page makes this come up. my code is as follows (I have typed in line 18 for this example, but i dont have it on my actual script)
_______________________________________________________
<!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>My First Page</title>
</head>
<body>
<h1>My first Page</h1>
<a href="index.php">home</a><br />
<a href="index.php?page=tutorials">tutorials</a><br />
<?php
LINE 18!!!!! $page = $_GET['page'];
if ($page)
{
include ("content/".$page.".php");
}
else
{
echo "welcome to my website";
}
?>
</body>
</html>
______________________________________________________
Please help if you can, Im using dreamweaver, wamp and firefox!