Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/12/2010, 23:48
wilo087
 
Fecha de Ingreso: agosto-2009
Mensajes: 78
Antigüedad: 14 años, 8 meses
Puntos: 2
Funciona en local pero remoto no

Saludos,

tengo el siguiente problema, estoy tratando de general un XLS (archivo de ecxel) con unos registros extraidos de la base de datos, tengo el siguiente codigo:

Código PHP:

$html
'<table cellpadding="0" cellspacing="0" border="0" width="573" style="text-align:center">';
$html .= '<tr style="background:#b31117; color:#FFF;"><td style="padding-left:30px">NUMERO</td><td width="190">ID</td><td><table style="color:#FFF; width:320px; background:#b31117; text-align:left"> <tbody><tr> <td width=""> Codigo</td><td>Cedula </td><td>Telefono </td></tr></tbody></table></td>';
$j=0;
for (
$i=0$i<= 49$i++) {
        
$row_envios mysql_fetch_assoc($envios);
        
$j++;
        
$id$row_envios['id'];
        if(!empty(
$row_envios['cedula'])){
            
$cedula=$row_envios['cedula'];
            }
        
        if(
$contador++ % 2){$html .= '<tr class="fondotabla">';}
        else {
$html .= '<tr>';}
        
$html .= '<td>'.$j.'</td>';
        
$html .= '<td>'.$row_envios['id'].'</td>';
        
$html .= '<td align="left">'.$cedula.'</td>';
        
$html .= '</tr>';
     }
$html .= '</table>'
aqui esta lo que regupero de la base de datos.

con un formulario hago la peticion a un fichero llamado xls.php para generar el archivos de excel:

Código HTML:
<form action="xls.php" method="post" name="formaulario1" style="width:102px; float:right;">
  <input type="hidden" name="html" value="<?php echo htmlentities($html); ?>" />
 <input style="padding: 3px 20px; margin-right:5px;" type="submit" name="enviar" value="Exportar" />
</form> 
dicho archivo contiene el siguiente script:

Código PHP:
if ($_POST['html']):  
ob_start();

header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=Ganadores.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo 
$_POST['html']; 

ob_end_flush();
endif; 
aqui lo que hago es indicar las cabeceras para el xls y imprimir los registros que tengo en la base de datos.

el problema rapida en que esto me funciona correctamente en local, pero cuando lo subo al servidor remoto: un cpanel. me genera el xls vacio sin ninguno de los registros. alguna idea?