Originariamente inviato da hyde82
certo...qualcosa del genere l'abbiamo affrontata qui:
http://forum.html.it/forum/showthrea...readid=1461549
qui i dati provengono da un database ,ma puoi effettuare poche modifiche per adattarlo alle tue esigenze...
fammi sapere
ciao
ciao, grazie per il link.
mi sono fatto un'idea ed ho apportato un pò di modifiche:
Codice PHP:
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['elimina'])) {
$check = $_POST['checkbox'];
foreach ($check as $delete) {
unlink($delete);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Admin</title>
</head>
<body>
<table>
<form action="<?php $_SERVER['PHP_SELF']; ?>">
<?php
$dirname = "../gallery";
$images = scandir($dirname);
sort($images);
foreach ($images as $file) {
if ((substr($file, -5) == ".jpeg") || (substr($file, -4) == ".jpg") || (substr($file, -5) == ".JPEG") || (substr($file, -4) == ".JPG") || (substr($file, -4) == ".png")) {
echo <<<HTML
<tr>
<td>
<input type="checkbox" name="check" value="ON" />
</td>
<td>
[img]../gallery/$file[/img]
</td>
</tr>
HTML;
}
}
?>
<tr>
<td>
<input type="submit" value="Elimina" name="elimina" />
</td>
</tr>
</form>
</table>
</body>
</html>
l'unico problema che ho è come fare a passare il nome del/dei files da cancellare.