Hey getting an error on my code can anyone tell me how to fix it?
Notice: Use of undefined constant folder - assumed 'folder' in C:\xampp\htdocs\a\gallery.php on line 74
Notice: Use of undefined constant folder - assumed 'folder' in C:\xampp\htdocs\a\gallery.php on line 75
Here's the relevant section
$path = "./images/gallery";
$results = scandir($path);
foreach ($results as $result) {
if ($result !== "." and $result !== ".." and $result !== ".DS_Store"){
//only lists the folders we want
$folders[] = $result;
}
}
echo "<h2 id=\"galleryheaders\">";
foreach ($folders as $folder){
echo "<a href=\"gallery.php?folder=$folder\">$folder</a>\n";
}
foreach ($folders as $folder){
echo "<?gallery = . $folder>";
}
echo "</h2>";
if (isset($_GET[folder])) {
$gallery = $_GET[folder];
}else {
$gallery = $folders[0];
};
the lines it specifically mentions are those last 2 folders
echo "<a href=\"gallery.php?folder=".$folder."\">".$folder."</a>\n";in place ofecho "<a href=\"gallery.php?folder=$folder\">$folder</a>\n";if (isset($_GET['folder'])) { $gallery = $_GET['folder']; }else { $gallery = $folders[0]; };