PHP使用按钮下载,删除和重命名文件

So I am creating a small file manager with php that will list in a table all available files in a directory on my server and provide me with a downloads or delete option.

This is my code:

<html>
<head>
    <title>My first PHP Page</title>
</head>

<body>
    <iframe id="my_iframe" style="display:none;"></iframe>
    <table border="1">
    <?php
        $dir = 'uploads';
        $files = scandir($dir);
        sort($files);
        $count = -1 ;
        foreach ($files as $file) {
            if ($file != '.' && $file != '..') {
                $str_URL = "uploads".$file;
                echo "<tr>";
                echo "<td>";
                echo $count;
                echo "</td>";
                echo "<td>";
                echo $file;
                echo "</td>";
                echo "<td>";
                echo "<input type='submit' value='Download'/>";
                echo "</td>";
                echo "<td>";
                echo "<input type='submit' value='Delete'/>";
                echo "</td>";
                echo "<td>";
                echo "<input type='submit' value='Rename'/>";
                echo "</td>";
                echo "</tr>";
            }
            $count++;
        }
    ?>
</table>
</body>
</html>

enter image description here

I am able to list files but I can't get the "download" and "delete" buttons to work properly.

Any help is greatly appreciated and thank you very much in advance.

Look at my code

<html>
<head>
    <title>My first PHP Page</title>
</head>

<body>
    <iframe id="my_iframe" style="display:none;"></iframe>
    <table border="1">
    <?php
        $dir = 'uploads';
        $files = scandir($dir);
        sort($files);
        $count = -1 ;
        foreach ($files as $file) {
        $v_download = "download_".$count;
        $v_delete = "delete_".$count;
        $v_rename = "rename_".$count;
            if ($file != '.' && $file != '..') {
                $str_URL = "uploads".$file;
                echo "<tr>";
                echo "<td>";
                echo $count;
                echo "</td>";
                echo "<td>";
                echo $file;
                echo "</td>";
                echo "<td>";
                echo "<form action='' method='post'><input type='submit' value='Download' name='".$v_download."'/></form>";
                if(isset($_POST[$v_download])) {
                // Your php download code here
                echo "download file : ".$file;
                }
                echo "</td>";
                echo "<td>";
                echo "<form action='' method='post'><input type='submit' value='Delete' name='".$v_delete."'/></form>";
                if(isset($_POST[$v_delete])) {
                // Your php delete code here
                echo "delete file : ".$file;
                }
                echo "</td>";
                echo "<td>";
                echo "<form action='' method='post'><input type='submit' value='Rename' name='".$v_rename."'/></form>";
                if(isset($_POST[$v_rename])) {
                // Your php rename code here
                echo "rename file : ".$file;
                }
                echo "</td>";
                echo "</tr>";
            }
            $count++;
        }
    ?>
</table>
</body>
</html>