If you put for example files[] inside name="" in the checkbox it automatically assigns the first file as 0, the second as 1 etc. in the array.
Like...
$files[] = 'foo.txt';
$files[] = 'foo2.txt';
$files[] = 'foo3.txt';
Then $files[0] would output foo.txt
$files[2] would output foo3.txt etc.
I made this for you...
<form action="" method="post">
<?
$handle = opendir('.');
while($file = readdir($handle))
{
if($file != '.' && $file != '..' && !is_dir($file))
{
echo '<input type="checkbox" name="files[]" value="' . $file . '">' . $file . '<br>';
}
}
?>
<input type="submit" name="submit" value="Submit">
</form>
<?
extract($_POST);
if($submit)
{
for($i = 0; $i < count($files); $i++)
{
unlink($files[$i]);
}
}
?>