joshgarrod Posted March 17, 2008 Share Posted March 17, 2008 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 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 17, 2008 Share Posted March 17, 2008 that is a 'notice', not an error. turn down error_reporting in PHP to get rid of it. error_reporting(E_ERROR | E_WARNING | E_PARSE); Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 17, 2008 Share Posted March 17, 2008 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! Quote Link to comment Share on other sites More sharing options...
joshgarrod Posted March 17, 2008 Author Share Posted March 17, 2008 Ok, thanks. that has fixed that, but it is not displaying my page? by this i mean the 'main' page, it displays other pages. what would the reason for that be? Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 17, 2008 Share Posted March 17, 2008 Because you aren't passing a page value with get, like ?p=page. Try adding that with a known file name in place of page (without the .php"). Quote Link to comment Share on other sites More sharing options...
joshgarrod Posted March 17, 2008 Author Share Posted March 17, 2008 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? Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 17, 2008 Share Posted March 17, 2008 Yeah, so your default should be index.php. Try just changing include($default); to include("index.php"); Quote Link to comment Share on other sites More sharing options...
joshgarrod Posted March 17, 2008 Author Share Posted March 17, 2008 that cant be right, the page i am trying to load main within is call index, i dont want to display index within index? Quote Link to comment Share on other sites More sharing options...
lemmin Posted March 17, 2008 Share Posted March 17, 2008 Sorry, I meant include("main.php"); whatever your home page file is. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.