I want to use the unlink function to delete files who's checkbox is checked. Below is the code I am using, which is not working. I know I'm probably way off here...... Has anyone done this before???
Thanks,
Jamie
<?
$dh = opendir('upload');
while($file = readdir($dh)) {
//if $file == '.' or == '..' skip it
//and if file extension == '.php3' or '.php' or '.phtml' make a link to $file
if($file != '.' && $file != '..' && ereg(".(php3|php|phtml|doc|wk4|xls)",$file)) {
echo "<INPUT TYPE=checkbox NAME=checkbox value=\"$checked\"> <A href=/construction/upload/$file>$file</A>\n";
print "<br>";
}
}
for ($i=0;$checkbox[$i]!="";$i++)
{
if(isset($delete))
{
$delete = "/home/httpd/html/construction/upload/$file";
unlink("$delete where $file=" . $checkbox[$i] );
}
}
?>
<FORM ENCTYPE="multipart/form-data" ACTION="<? $PHP_SELF ?>" METHOD="POST">
<INPUT TYPE="submit" name="delete" VALUE="delete">
</FORM>