$WhichMainMenuItem is an array defined at the beginning of the script. I didn't include the whole before because it got so spammy, but here it is: [code] <?php $WhichMainMenuItem = Array ( '/FAQ/' => 'VolumeI', '/SSM/' => 'VolumeI', '/Concordance/' => 'VolumeII', '/Encyclopaedia/' => 'VolumeII', '/Heraldry/' => 'VolumeII', '/History/' => 'VolumeII', '/Characters/' => 'VolumeIII', '/Prophecies/' => 'VolumeIII', '/Artwork/' => 'VolumeIV', '/Books/' => 'VolumeIV', '/Images/' => 'VolumeIV' ); $WhichMainMenuItemID = Array ( '/FAQ/' => 'main01', '/SSM/' => 'main01', '/Concordance/' => 'main02', '/Encyclopaedia/' => 'main02', '/Heraldry/' => 'main02', '/History/' => 'main02', '/Characters/' => 'main03', '/Prophecies/' => 'main03', '/Artwork/' => 'main04', '/Books/' => 'main04', '/Images/' => 'main04' ); $WhichSubMenu = $WhichMainMenuItem; $WhichSubMenuItem = Array ( '/FAQ/' => 'FAQ', '/SSM/' => 'SSM', '/Concordance/' => 'Concordance', '/Encyclopaedia/' => 'Encyclopaedia', '/Heraldry/' => 'Heraldry', '/History/' => 'History', '/Characters/' => 'Characters', '/Prophecies/' => 'Prophecies', '/Artwork/' => 'Artwork', '/Books/' => 'Books', '/Images/' => 'Images' ); $URL = $_SERVER['PHP_SELF']; $Parts = explode("/",$URL); if ($Parts[2] != "index.php" && $Parts[2] != "index.html") { $CurrentSection = "/".$Parts[2]."/"; } elseif ($Parts[2] == "index.html") { die; } elseif ($Parts[2] == "index.php" && $Parts[3] != "NULL" && array_key_exists($WhichMainMenuItem,$Parts[3])) { $CurrentSection = "/".$Parts[3]."/"; } else { die; } if(isset($CurrentSection)){ $MainMenuItem = $WhichMainMenuItem[$CurrentSection]; $MainMenuItemID = $WhichMainMenuItemID[$CurrentSection]; $SubMenu = $WhichSubMenu[$CurrentSection]; $SubMenuItem = $WhichSubMenuItem[$CurrentSection]; }; ?> [/code] Do I have the correct syntax then for checking whether $Parts[3] is part of this array? Edited to add: I tried out the modified code, and I now get this error: Warning: array_key_exists(): The second argument should be either an array or an object in <filename>. However, it only occurs when I access the code on an URL including the 'www'. So, wwww.domain.com/Citadel/About/ generates the error, but not domain.com/Citadel/About/. Why would that happen?