You should just need to put the folder "documents/newsletters/" in the link and it will work.
So:
PHP Code:
print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");
Would become:
PHP Code:
print("<TR><TD><a href=\"documents/newsletters/$dirArray[$index]\">$dirArray[$index]</a></td>");
I have rewritten the code below to use the PHP SPL library to access the files if your interested.
PHP Code:
<?php
$directoryPath = 'documents/newsletters';
$linksArray = array();
$filesArray = new DirectoryIterator($directoryPath);
foreach ($filesArray as $file) {
if($file->isDot()) {
continue;
}
$linksArray[] = $file->getFilename();
}
if ($linksCount = count($linksArray)) {
echo '<table border="1" cellpadding="5" cellspacing="0" class="whitelinks"><tr><th>Issue</th></tr>';
foreach ($linksArray as $link) {
echo '<tr><td><a href="' . $directoryPath . '/' . $link . '">' . $link . '</a></td></tr>';
}
echo '</table>';
}