[Solved] Code throws warning: Undefined index in GET array [duplicate]


Its because if the ?page paramater isn’t set in the URL it will throw that error. Replace with the following code:

$page = (isset($_GET['page'])) ? $_GET['page'] : '';  // gets the variable $page ******
//global $page;

if (!empty($page)){
    include($page);
}   // if $page has a value, include it
else {
    include("home.php");
}   // otherwise, include the default page

solved Code throws warning: Undefined index in GET array [duplicate]