I wrote this code to dynamically generate an array from files on my server and put it into a drop down menu, but the code cannot be inserted on any page anywhere without it cancelling the loading of the rest of the page. Any ideas? Here is the code:
<? $the_array = Array();
$handle = opendir('walrus/strips/.');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file = substr($file, 0, -4);
$the_array[] = $file;
}
}
closedir($handle);
asort ($the_array);
reset ($the_array);
$category = $the_array;
$category = str_replace(" ", " ", $category);
echo '<SELECT ONCHANGE="location = this.options[this.selectedIndex].value;" id= "eppick" name=category>';
echo ' <option selected>Episode List</option>';
foreach ($category as $key => $value)
{
echo '<OPTION value="?display=comic&date='.$value.'"> '.$value.'</option>';
}
?>
Thanks in advance.