Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/07/2008, 11:20
Avatar de pato12
pato12
 
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 7 meses
Puntos: 101
Respuesta: error bucle foreach

Hola,
Intenta haci:
Código PHP:
<?php  

$the_array 
= Array();   
$handle opendir('../imagenes/');   
while (
false !== ($file readdir($handle))) {   
   if (
$file != "." && $file != "..") {   
   
$the_array[] = $file;   
   }   
}   
closedir($handle);   
sort ($the_array);   
foreach(
$the_array as $val){   


        echo  
"<tr>  
    <td width='43'>  
      <input type='checkbox' name='val[]' value='$val' />  
    </td>  
    <td width='440' class='style3'>$val</td>  
  </tr>"
;  
    }  
   
?>
y
Código PHP:
<?  

    
foreach($_GET['val'] as $val2)  
    {  
        echo 
'Deleting file [' $val2'] ... ';  
        
unlink('../imagenes/'.$val2);  
        echo 
'Done!<br />';  
    }  

?>
Estube trabajando en algo similar y tenia un error y era porque a el name del checkbox le puse algo y deveria ser algo[].
Suerte
Salu2
__________________
Half Music - www.halfmusic.com