Ver Mensaje Individual
  #9 (permalink)  
Antiguo 13/07/2006, 12:09
Avatar de da2
da2
 
Fecha de Ingreso: abril-2003
Ubicación: Catalunya
Mensajes: 239
Antigüedad: 21 años
Puntos: 0
El formulario del checkbox lo he dejado asi:

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[$o]\" value=".$imagen[$o]."></td>"
        }
    } 
Y me crea este codigo fuente:
Código HTML:
<table><form action='borrarimagen.php' method='post'><tr align="center"><td><a href=imagenes//CatherineDeneuve.jpg target='_blank'><img border='0' src=imagenes/small//CatherineDeneuve.jpg><br></a><input type="checkbox" name="imagen[1]" value=CatherineDeneuve.jpg></td><td><a href=imagenes//Thumbs.db target='_blank'><img border='0' src=imagenes/small//Thumbs.db><br></a><input type="checkbox" name="imagen[2]" value=Thumbs.db></td></tr><tr align="center"></tr></table><input type='submit' value='Borrar'></form><a href="escandir.php?&page=1">1</a> <table border='0' width='100%'>
  <tr>
    <td width='100%'><br><a href='opers.php'>Volver a la Agenda</a><br></td>
  </tr>
  <tr>
    <td width='100%'><p align='center'>Version 0.2</td>
  </tr>
</table> 
Ahora cuado llega a la pagina borrarimagen.php
Código PHP:
$path="imagenes/small/";
$pathi "imagenes/";
 
$imagenborrar =$_POST['imagen'];
 echo 
$imagenborrar;


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>"
   } 

el valor sigue siendo Array cuando parce que cada componenete del array tiene su valor.