Tạo ra file: form.html

//Các file xóa phải tồn tại (nhớ đây là ví dụ thôi)

<form action="process.php" method="post">
    <input type="checkbox" value="file1.html" name="delete[]"> file1.html<br>
    <input type="checkbox" value="file2.html" name="delete[]"> file2.html<br>
    <input type="checkbox" value="file3.html" name="delete[]"> file3.html<br>
    <input type="submit" value="Delete Selected" name="submit">
</form>

Tạo process.php

<?php 
foreach($_POST['delete'] as $delete){ 
    if(file_exists("/location/of/directory/".$delete)){ 
        unlink("/location/of/directory/",$delete); 
    }else{ 
        continue; 
    } 
} 
header("Location: form.html"); 
?>

 

Đăng ký theo dõi ủng hộ kênh