Pregunta:
Fecha: 25-06-2018 08:51:50
(En Español)
html:
No me funciona la descarga del archio XLS[No resuelta]
Hola alguien sabe porque cuando mando a descargar no me arroja errores pero no descarga nadahtml:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="expo.php">
<input type="submit" metod="export" class="btn btn-success" value="export">
</form>
</body>
</html>
php:
$con = oci_connect("hr", "hr","localhost/xe");
$output = '';
if(isset($_POST["export_excel"]))
{
$sql = "select * from departments";
$resultado = oci_parse($con, $sql);
if(oci_num_rows($resultado) > 0)
{
$output .='
<table class="table" bordered="1">
<tr>
<th>departments_id</th>
<th>departments_name</th>
<th>manager_id</th>
</tr>
';
while ($row = oci_fetch_array($resultado)) {
$output .='
<tr>
<th>'.$row ["departments_id"].'</th>
<th>'.$row ["departments_name"].'</th>
<th>'.$row ["manager_id"].'</th>
</tr>
';
}
$output .='</table>';
header("content-Type:application/xls");
header("Content-Disposition: attachment;filename=download.xls");
echo $output;
}
}
?>
Votos: -1 -
Respuestas: 1 -
Vistas: 10
Compartir en: Google
Facebook
Twitter
LinkedIn
Link
Respuestas:
-
Fecha: 26-06-2018 06:42:58 Amigos será que pueden utilizar las etiquetas de codigo que estan en el editor, es más fácil interpretar el código, para ello estan:
$con = oci_connect("hr", "hr","localhost/xe"); $output = ''; if(isset($_POST["export_excel"])) { $sql = "select * from departments"; $resultado = oci_parse($con, $sql); if(oci_num_rows($resultado) > 0) { $output .=' <table class="table" bordered="1"> <tr> <th>departments_id</th> <th>departments_name</th> <th>manager_id</th> </tr> '; while ($row = oci_fetch_array($resultado)) { $output .=' <tr> <th>'.$row ["departments_id"].'</th> <th>'.$row ["departments_name"].'</th> <th>'.$row ["manager_id"].'</th> </tr> '; } $output .='</table>'; header("content-Type:application/xls"); header("Content-Disposition: attachment;filename=download.xls"); echo $output; } } ?>
se ve distinto no? Votos: 2 - Link respuesta
Para participar activamente de la comunidad primero debes autenticarte, ingresa al sistema.Iniciar Sesión
