saludos compañeros, les cuento tengo un formulario en el que consulto unos datos y me los lista en pantalla  muy bien, pero cuando le coloco el codigo para exportar a excel me saca error mas no le veo la falla
si alguien me puede asesorar le agradesco.
 este es el error
 
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\exportar.php:9) in C:\AppServ\www\exportar.php on line 11
 
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\exportar.php:9) in C:\AppServ\www\exportar.php on line 12
 estos datos me los lista despues del error que es lo que quiero pasar a excel
Codigo   Album Nombre Album 
0               carlos andres 
0               carlos andres  
0                carlos andres  
  codigo php
 
<?php 
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=NombreDelExcel.xls"); 
 
$conexion=mysql_connect("localhost","root","1") or die(" no se realizo la conexion ");
mysql_select_db("cecap") or die ("no se encontro la base de datos ");
 
 $opc=$select;
 $vacio=0;
 switch($opc)
 {
 case 1:
      if ($consecutivofac>$vacio)
	     {  
			  $consulta="select* from facturacion where consecutivofac='$consecutivofac'"; 		
 
		 }
 
  break;
 case 2:
   echo '<script> alert("value2") ;</script>';
   $consulta="select* from facturacion where consecutivofac='$consecutivofac'"; 
  break;
 
   case 6:
         echo '<script> alert("Seleccione una tabla.") ;</script>';
		 echo '<script type="text/javascript"> window.location="/exportar.html"; </script>' ; 
  break;
 
  }
  $resultado=mysql_query($consulta) or die ("consulta incorrecta");
  $registros=mysql_num_rows($resultado);
  if($registros==0)
     {
       echo "el valor consultado no existe ";
       }
       else
       {
?>
<table border="1" align="center">
    <tr>
     <td>Codigo Album</td>
     <td>Nombre Album</td>
 
 
     </tr>
<?
 while($filas=mysql_fetch_array($resultado))
      {
 
?>
    <tr>
   <td><? echo $filas["consecutivofac"];?></td>
   <td><? echo $filas["nombre"];?></td>
 
 
   </tr>
   <?php
     }
     }
 
?> 
   
 

 problema al exportar excel php
 problema al exportar excel php 
 Respuesta: problema al exportar excel php
 Respuesta: problema al exportar excel php 

