Here is the code.
<?php
$dirname = 'music';
$dir = new DirectoryIterator($dirname);
foreach ($dir as $path => $splFileInfo)
{
if ($splFileInfo->isDir())
continue;
$output = explode(' ', $splFileInfo, 5);
echo "<form>";
?><input type="checkbox" name="<?php echo $output[0] ?>" /><?php echo "$output[0]"; ?>
<input type="checkbox" name="<?php echo $output[1] ?>" /><?php echo "$output[1]"; ?>
<input type="checkbox" name="<?php echo $output[2] ?>" /><?php echo "$output[2]"; ?>
<?php echo "</form>";
}
?>
This causes there to be two extra checkboxes after the ones coded for. Example: image since it won’t let me post images yet.
I think you’re trying to do something in the loop that should be done outside it. I expected that exact output based on the code, so let me take a stab at a fix here: