PHP Notice: Undefined index: content in... Please help

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
Cgull
Forum Newbie
Posts: 7
Joined: Wed Apr 09, 2008 6:11 am

PHP Notice: Undefined index: content in... Please help

Post by Cgull »

Hi,

I just uploaded a new site I've created that works fine on my machine, but online I get this error on the home page:

PHP Notice: Undefined index: content in C:\Domains\sigalz.co.za\wwwroot\cv\xhtml\index.php on line 24

In my index file, I have this code:

Line 24 is marked in Red:

<?php
if (!isset($_REQUEST['content']))
$nextPage = "content/main.inc.php";

else
$nextPage = "content/" . $_REQUEST['content'] . ".inc.php";

if($_REQUEST['content'] != "gallery")
include($nextPage);
?>

Any ideas what can cause this?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP Notice: Undefined index: content in... Please help

Post by Christopher »

Code: Select all

   if (!isset($_REQUEST['content'])) {
       $nextPage = "main";
    } else {
       $nextPage = $_REQUEST['content'] ;
    }                       
    if($nextPage  != "gallery") {
       include("content/" . $nextPage. ".inc.php");
    }
(#10850)
Cgull
Forum Newbie
Posts: 7
Joined: Wed Apr 09, 2008 6:11 am

Re: PHP Notice: Undefined index: content in... Please help

Post by Cgull »

Thank you very much :)
Post Reply