dynamic html pages in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
congos
Forum Newbie
Posts: 2
Joined: Sat Nov 19, 2011 11:41 am

dynamic html pages in php

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: dynamic html pages in php

Post 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.
Post Reply