OK, I believe the problem is because your image array is being set relative to the path structure from within the included file...
So in other words, this:
$imgpath[0] = "gallery/mbh";
when processed in your FOR loop is looking here:
/bms/includes/gallery/mbh
and of course, there are no images there... Try this in your includes file:
In your FOR loop, add the "../" to the path name. Don't hard set it in each imgpath definition, because you need to define the path without it in your original file, since the path is relative to that.
for ($i=0; $i<$TotalImages; $i++) {
$imgpath[$i] = "../".$imgpath[$i]; // Add this to the loop
$handle= opendir( "$imgpath[$i]");
$imgArray[$i] = array();
while($file = readdir($handle)){
if( $file != "." && $file != ".." ){
array_push( $imgArray[$i], $file );
}
}
closedir( $handle );
}
In your original file, your call would be:
<?php print( "<IMG SRC=\"$imgpath[1]/" . $imgArray[1][ $randval[1] ] . "\">" );?>
I hope this makes sense, and works for you. Good Luck with it.