Page 1 of 1

dynamic html pages in php

Posted: Sun Nov 20, 2011 7:22 am
by congos
im new to php and im try to work on dynamic html pages with php
everything seemed to ok but when i try to make pages dynamically
an error shows up like this
Notice: Undefined index: page in C:\xampp\htdocs\myfolder\website\inter.php on line 5
i checked it out on the net and someone insisted on using this(@) in front of $ it worked
though when i try to click on the navbar the design button i get this error

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

Code: Select all

<?php

include ("includes/header.html");
include ("includes/navbar.html");
if ($_GET['page'] == "design")
{
      include ("includes/design.html"); 
  }
  
else {
     include ("includes/home.html");
}  

include ("includes/footer.html");
?>
somebody help because this error is pulling backwards

Re: dynamic html pages in php

Posted: Sun Nov 20, 2011 9:44 am
by Celauran
congos wrote:an error shows up like this
Notice: Undefined index: page in C:\xampp\htdocs\myfolder\website\inter.php on line 5
This is a notice. Errors start with the word "error". Crazy, right? Errors stop your code from working, notices warn you about possible bugs. Not the same thing.

That said, the reason you're getting that notice is because you're referring to a variable -- in this case an array index -- which may not have been set. Using the @ just suppresses the notice, it doesn't fix anything. To fix it, make sure the variable in question has been set before using it in a comparison operation.
congos wrote:though when i try to click on the navbar the design button i get this error

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
You haven't posted the code for that page (or at least that link) so it's difficult for us to comment on it. The PHP you posted looks fine (save for the missing isset() call, of course).
congos wrote:somebody help because this error is pulling backwards
I don't understand what this means.