exp.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?
  2. //require_once("ui.index.php");
  3. $filename = 'account_history_'.date('mdY').'.csv';
  4. //$strExportList = array(0=>'a',1=>'b',2=>'c');
  5. //$strExportList=$_REQUEST['strExportList'];
  6. //echo "Transaction Date, Particulars, Amount($)";
  7. if($_REQUEST[qtype]=="1"){
  8. $strRows .="Total No. of users attempted this survey =";
  9. $strRows .=$_REQUEST['count_total_user'];
  10. $strRows .="\n";
  11. $strRows .=$_REQUEST['caption'];
  12. $strRows .= ",";
  13. $strRows .= "No. of Votes";
  14. $strRows .= ",";
  15. $strRows .= "Result (%)";
  16. $strRows .="\n";
  17. $strRows .=$_REQUEST['a1'];
  18. $strRows .=",";
  19. $strRows .=$_REQUEST[count_a1];
  20. $strRows .=",";
  21. $strRows .="30%";
  22. $strRows .="\n";
  23. $strRows .=$_REQUEST['a2'];
  24. $strRows .=",";
  25. $strRows .=$_REQUEST[count_a2];
  26. $strRows .=",";
  27. $strRows .="40%";
  28. }
  29. if($strExportList[0])
  30. {
  31. $intCount = 0;
  32. //$strRows='';
  33. foreach($strExportList as $arrRow)
  34. {
  35. $ItemCount = count($strExportList);
  36. $strRows .=strip_tags(str_replace("<BR>"," ", $arrRow[0])).",";
  37. $strRows .=str_pad($arrRow[1],255);
  38. $strRows .=",".str_pad($arrRow[2],12);
  39. $strRows .=",";
  40. $strRows.= "\r\n";
  41. $intCount++;
  42. }
  43. }
  44. // Stream the file, will prompt user to open or save
  45. header("Content-type: application/vnd.ms-excel");
  46. header ("Content-Type: application/octet-stream");
  47. header("Content-disposition: attachment; filename=$filename");
  48. header("Pragma: no-cache");
  49. header("Expires: 0");
  50. echo $strRows;
  51. die();
  52. ?>