Jump to content

PHP navigation error


joshgarrod

Recommended Posts

Hello all, I had a lovely working nav system for my website, now since I have moved servers it doesn't want to work for my 'main' page which is the default page brought up on typing in the url. the error I am getting is this

Notice: Undefined index: page in e:\domains\e\mysite.com\user\htdocs\index.php on line 151

 

But I am not convinced it my index page that is the problem.

 

here is the nav code from the index page

<?php 

// Start PHP Navigation Sytem

$default = "main.php";

$page = $_GET['page'];

if(isset($page)){

include($page.".php");}

else 
{
include($default);}

// END PHP Navigation System
?>

 

Anyone any ideas as to what is going wrong please?

 

Thanks v much in advance

 

Link to comment
Share on other sites

Your main page used to have a ?page=something appended to it. Also, this code should be switched around:

$page = $_GET['page'];

if(isset($page)){

to:

if(isset($_GET['page']))
  $page = $_GET['page'];
  include($page.".php");}

else 
{
include($default);}

 

Good luck!

Link to comment
Share on other sites

It does work, i think it must be something within my main.php pge that is screwing it up, the first page that is meant to display screws it up, but if you click a link you see how it should be displayed. i tried putting another page as the default and it worked fine?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.