Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/07/2008, 11:06
charlyta
 
Fecha de Ingreso: junio-2008
Mensajes: 291
Antigüedad: 15 años, 10 meses
Puntos: 9
error bucle foreach

Hola. tengo un error en este bucle foreach y no sé dónde.... alguien me puede echar un cable? gracias


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

    } 
  
?>
para el unlink



Código PHP:
<? 

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

?>