Just another question..
I used the following code in a php file called index.php
<?php
if ($link == page2){
$page="pages/page2.html";
}
elseif($link == page3){
$page="pages/page3.html";
}
else{
$page="pages/page1.html";
}
?>
<html>
<head><title></title></head>
<body>
<a href="index.php?link=page1"> Page 1 </a><br>
<a href="index.php?link=page2"> Page 2 </a><br>
<a href="index.php?link=page3"> Page 3 </a><br>
<?php include($page); ?>
</body>
</html>
and when i tried to access index.php like so
index.php?link=page1
It gives me these errors:
Notice: Use of undefined constant page2 - assumed 'page2' in C:\Documents and Settings\PC\My Documents\WWW\home\index.php on line 2
Notice: Use of undefined constant page3 - assumed 'page3' in C:\Documents and Settings\PC\My Documents\WWW\home\index.php on line 5
And when i access index.php without passing the variable 'link', i get even more errors like so:
Notice: Undefined variable: link in C:\Documents and Settings\Paul Chang\My Documents\WWW\home\index.php on line 2
Notice: Use of undefined constant page2 - assumed 'page2' in C:\Documents and Settings\Paul Chang\My Documents\WWW\home\index.php on line 2
Notice: Undefined variable: link in C:\Documents and Settings\Paul Chang\My Documents\WWW\home\index.php on line 5
Notice: Use of undefined constant page3 - assumed 'page3' in C:\Documents and Settings\Paul Chang\My Documents\WWW\home\index.php on line 5
I can understand where the error is coming from, but I have very little idea how to fix it. 🙁
Is it absolutely necessary to use index.php?link=page1 to access page 1? Can't I just access index.php and that's all?
By the way, I've turned on globals now.