Yo he intentado algo parcido pero me sale este error:
Warning: Invalid argument supplied for foreach()
El checkbox biene de aquí...
Código PHP:
if ($imagen[$o]){
echo "<td><a href=".$pathi."/".$imagen[$o]." target='_blank'><img border='0' src=".$path."/".$imagen[$o]."><br></a><input type='checkbox' name='imagen' value=".$imagen[$o]."></td>";
}
}
Y en pagina borrarimagen.php tengo esto
Código PHP:
$path="imagenes/small/";
$pathi = "imagenes/";
$imagenborrar =$_POST['imagen'];
foreach ($_POST['imagen'] as $imagen){
$borrar = $path.$imagenborrar;
$borrari = $pathi.$imagenborrar;
if (file_exists($path)){
unlink($borrar);
unlink($borrari);
echo $path." --> Borrado<br>";
} else {
echo "<b>".$path." --> FALLÓ Borrado</b><br>";
}
}
Alguien podría decirme que hago mal?
Gracias.