PHP Delete File script
<p>I have a basic PHP script that displays the file contents of a directory. Here is the script:</p>

<pre><code>&lt;?php

$Dept = "deptTemplate";

if(isset($_REQUEST['dir'])) {  
    $current_dir = $_REQUEST['dir'];  
} else {
    $current_dir = 'docs';
}

if ($handle = opendir($current_dir)) {  
     while (false !== ($file_or_dir = readdir($handle))) {  
        if(in_array($file_or_dir, array('.', '..'))) continue;  
        $path = $current_dir.'/'.$file_or_dir;  
        if(is_file($path)) {  
            echo '`&lt;a href="/Implementation/'.$Dept.'/'.$path.'"&gt;'.$file_or_dir.'&lt;/a&gt; - [Delete button/link]&lt;br/&gt;`';  
        } else {  
            echo '`&lt;a href="testFolderiFrame.php?dir='.$path.'"&gt;`'.$file_or_dir."\n`&lt;/a&gt;` - [Delete button/link]`&lt;br/&gt;`";  
        }
    }
    closedir($handle);  
}
?&gt; 
</code></pre>

<p>I am trying to create a delete link/button that displays next to each file and when clicked, the corresponding file will be deleted. Would you know how to do this?</p>
