Hi, i need to export particular data to a excel file.
When user clicks on the export to link i need to display a pop up saying "Export to excel".I have some part of this.But the matter is excel creating page is showed in another tab.
$f is='453'

<a href="../excel1/reorder.php?id='.$f.'">Export</a>';?>

and after that
page redirect to this:

<html>
<head>
<script language="javascript">
function download()
{
	window.location='report.xls';
}
</script>
</head>
<body onLoad="download();">

<?php


require_once("excelwriter.class.php");
require_once('../library/myconn.php');

		  $u=$_POST['rquery'];
		  $fname=$_POST['rfields'];



$excel=new ExcelWriter("report.xls");
if($excel==false)	
echo $excel->error;

$myArr=(explode(",",$fname));

$excel->writeLine($myArr);


$resultu=mysql_query($u);
 while ($rowu = mysql_fetch_array($resultu)) {

  for($i=0;$i<count($rowu);$i++){

$myArr[$i]=$rowu[$i];

   }	
   $excel->writeLine($myArr);	
}
// header("refresh: 2; ../import/search_result.php");
//exit;

?>

</body>
</html>

The thing is i need to stay on the same page when user tries to export data to a excel...
I hope everyone got the idea...
Thanks in advance...
Waiting to see some help thanks...........

    Write a Reply...