Export to xls is not working

<?php include("ILSP_Mains.php"); $fileName = "GroupSocialRpt.php"; $formname = "ilsp_GPSoc"; ?> 
<head><link rel="stylesheet" type="text/css" href="css/form_style.css" /><link href="css/newtable.css" rel="stylesheet" type="text/css" media="all" />
<script language="JavaScript" >function callsubmit(){ var fa01 = document.getElementById("dist").value; var fa02 = document.getElementById("blck").value; 
if(fa01 !=''){ var fa03 = document.getElementById("vill").value; self.location='GroupSocialRpt.php?&dist='+fa01+'&blck='+fa02+'&vill='+fa03;
 document.reload(true); }} function callsubmit1(){ var fa01 = document.getElementById("dist").value; var fd11 = document.getElementById("fin_yer").value;
  var fd12 = document.getElementById("mnth1").value; var fa02 = document.getElementById("blck").value; var fa03 = document.getElementById("vill").value;
  if(fd11 != '' || fd12 != ''){ self.location='GroupSocialRpt.php?&dist='+fa01+'&fin_yer='+fd11+'&mnth1='+fd12+'&blck='+fa02+'&vill='+fa03; 
  document.reload(true); }}
</script></head>
<div class="form-style-2">
<div class="form-style-2-heading">ILSP - Group (PG/VPG) Social (Component 1)</div>
<form name="ilsp_GPSoc" action="" method="post" >
<div class="form-style-2-heading">District&nbsp;&nbsp;
    <?php
    	$sqlDist0 = "SELECT dis_code FROM ilsp_login_d where Acc_No='$UserACON2' order by dis_code";
    	$resDist0 = mysql_query($sqlDist0); $rowDist0 = mysql_fetch_array($resDist0); $DistCode0 = $rowDist0[0]; $di1 = 0;	 
    	$sqlDist11 = "SELECT dis_code,dis_name FROM ilsp_district order by dis_code";
    	$resDist11 = mysql_query($sqlDist11); while($rowDist11 = mysql_fetch_array($resDist11))
    	{ $DistCode1[$di1] =  $rowDist11['dis_code']; $DistName1[$di1] =  $rowDist11['dis_name']; $di1++; }
    ?>
    <select size="1" name="dist" id="dist" onChange="return callsubmit();" class="select-field">
    <option value=""></option>
    <?php for($k4 = 0; $k4 < count($DistCode1); $k4=$k4+1) { $selected=($dist==$DistCode1[$k4]) ? 'selected' : ''; ?>
    	<option value="<?=$DistCode1[$k4]?>"<?=$selected?>><?=$DistName1[$k4]?></option><?php } ?> </select>
&nbsp;&nbsp;Block&nbsp;&nbsp;    
    <?php if($UserACCN2!=9){$sql_id = "SELECT blc_code,blc_name FROM ilsp_block where dis_code='$dist' order by blc_name";}
          if($UserACCN2 == 9) { $sqlDist2 = "SELECT b.blcid FROM ta_blck b where b.tacode='$UserACON2' ";
            $resDist2 = mysql_query($sqlDist2); $rowDist2 = mysql_fetch_array($resDist2); $TAblck1 = $rowDist2['blcid'];
            $sql_id = "SELECT blc_code,blc_name FROM ilsp_block where dis_code='$dist' and blc_code='$TAblck1' order by blc_name";
          }  $result_id = mysql_query($sql_id); 
    ?>
    <select size="1" name="blck" id="blck" onChange="return callsubmit();" class="select-field"><option value=""></option>
    <?php while($row_id = mysql_fetch_array($result_id)) { $selected=($blck==$row_id['blc_code']) ? 'selected' : ''; ?>					
    <option value="<?=$row_id['blc_code']?>"<?=$selected?>><?=$row_id['blc_name']?></option><?php } ?></select>
&nbsp;&nbsp;Village&nbsp;&nbsp;    
    <?php $sql_id = "SELECT vil_code,vil_name FROM ilsp_vill where blc_code='$blck' order by vil_name"; $result_id = mysql_query($sql_id);  ?>
    <select size="1" name="vill" id="vill" value="<?=$vill?>" onChange="return callsubmit();" class="select-field"><option value=""></option>
    <?php while($row_id = mysql_fetch_array($result_id)){ $selected=($vill==$row_id['vil_code']) ? 'selected' : '';	?>					
	<option value="<?=$row_id['vil_code']?>"<?=$selected?>><?=$row_id['vil_name']?> [<?=$row_id['vil_code']?>]</option><?php } ?></select>  
&nbsp;&nbsp;Finance Year&nbsp;&nbsp;
	<select size="1" name="fin_yer" id="fin_yer" value="<?=$fin_yer?>" onChange="return callsubmit1();"  class="select-field">
	<option value=""></option>
	<?php for($k4 = 0; $k4 < count($finYrr); $k4=$k4+1)	{ $selected=($fin_yer==$finYrr[$k4]) ? 'selected' : ''; ?>
	<option value="<?=$finYrr[$k4]?>"<?=$selected?>><?=$finYrr[$k4]?></option><?php } ?></select>
&nbsp;&nbsp;Month&nbsp;&nbsp;            
	<select size="1" name="mnth1" id="mnth1" value="<?=$mnth1?>" onChange="return callsubmit1();"  class="select-field">
     <?php 
	    $mnth111 = array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	   	for($k11=0; $k11 < 13; $k11++) {  $selected=($mnth1==$k11) ? 'selected' : ''; 
	 ?>	<option value="<?=$k11?>"<?=$selected?>><?=$mnth111[$k11]?></option><?php } ?></select>     
</div>
</form>
</div>
<?php
if($dist != '' && $blck != '') //  && $vill != ''
{   $dist = sanitize01($dist); $blck = sanitize01($blck); //$vill = sanitize01($vill);
	if($DistCode0 != 'U00') { $dist = $DistCode0; }
	$i2 = 0; $Sum7 = 0; $Sum8 = 0; $Sum9 = 0; $Sum10 = 0; $Sum11 = 0; $Sum12 = 0; $Sum13 = 0; 
	$Sum14 = 0; $Sum15 = 0; $Sum16 = 0; $Sum17 = 0; $Sum18 = 0; $Sum19 = 0; 
	
	if($dist=='ALL') { $sqlIDLCA = "Select dis_code,blc_code,blc_name from ilsp_block "; }
	if($dist!='ALL') { $sqlIDLCA = "Select blc_code,blc_name from ilsp_block where dis_code='$dist' "; }
	if($blck != '') { $sqlIDLCA .= " and blc_code='$blck' ";}
    if($UserACCN2 == 9) { $sqlDist2 = "SELECT b.blcid FROM ta_blck b where b.tacode='$UserACON2' ";
    $resDist2 = mysql_query($sqlDist2); $rowDist2 = mysql_fetch_array($resDist2); $TAblck1 = $rowDist2['blcid'];
    $sqlIDLCA .= " and blc_code='$TAblck1' ";} $sqlIDLCA .= " order by dis_code,blc_name ";
	$resIDLCA = mysql_query($sqlIDLCA);	while($rowIDLCA = mysql_fetch_array($resIDLCA))
	{	
		$F01i2 = $rowIDLCA['blc_code']; $F02i2 = $rowIDLCA['blc_name'];
		if($dist=='ALL')
		{	
			$F01i2a = $rowIDLCA['dis_code'];
			$sqlDist11 = "SELECT dis_name FROM ilsp_district where dis_code='$F01i2a' ";
			$resDist11 = mysql_query($sqlDist11); $rowDist11 = mysql_fetch_array($resDist11);
			$F02i2 .= "<br>(".$rowDist11['dis_name'].")";
		}
	   	$sqlid31 = "SELECT 	a1.gp_code,a1.gp_name,a2.vil_code,a2.vil_name FROM ilsp_group a1, ilsp_vill a2 
	   						where a2.blc_code='$F01i2' and a2.vil_code=a1.vil_code ";
        if($vill != ''){ $sqlid31 .= " and a1.vil_code='$vill' "; }  $sqlid31 .= " order by a2.vil_name,a1.gp_name ";
		$resid31 = mysql_query($sqlid31); while($rowid31 = mysql_fetch_array($resid31))
		{	
			$F01[$i2] = $F01i2; $F02[$i2] = $F02i2; $F03[$i2] = $rowid31['gp_code'];
			$F05[$i2] = $rowid31['gp_name']; $F08[$i2] = $rowid31['vil_code']; $F07[$i2] = $rowid31['vil_name'];		   	
		   	$sqlid302 = "SELECT fmdt,metdt FROM gpsocl where blc_code='$F01[$i2]' and vil_code='$F08[$i2]' and gp_code='$F03[$i2]' 
		   				order by blc_code,vil_code,gp_code";
			$resid302 = mysql_query($sqlid302); while($rowid302 = mysql_fetch_array($resid302))
			{
				$Fi005[$i2] = date("d-M-Y",strtotime($rowid302['fmdt'])); $Fi006[$i2] = date("d-M-Y",strtotime($rowid302['metdt']));
                if($Fi005[$i2] == '01-Jan-1970'){$Fi005[$i2] = '';} if($Fi006[$i2] == '01-Jan-1970'){$Fi006[$i2] = '';}       
			}

	 		$sqlid32 = "SELECT gnml,gnfl,scml,scfl,stml,stfl,obcml,obcfl,apl,bpl,joinmm,leftmm,entry_tym FROM gpsocl where 
	 					blc_code='$F01[$i2]' and vil_code='$F08[$i2]' and gp_code='$F03[$i2]' and (apl > 0 or bpl > 0) ";	 					
		   	if($fin_yer != '' && $fin_yer != 0) { $sqlid32 .= " and fin_yr='$fin_yer' "; }
	   		if($mnth1 != '' && $mnth1 != 0) { $sqlid32 .= " and mnth='$mnth1' "; }
		   	$sqlid32 .= " and entry_tym=(Select max(entry_tym) from gpsocl where gp_code='$F03[$i2]') ";
		   	$sqlid32 .= " order by blc_code,vil_code,gp_code,entry_tym ";
			$resid32 = mysql_query($sqlid32); while($rowid32 = mysql_fetch_array($resid32))
			{
				$Fi007[$i2] = $rowid32[0]; $Fi008[$i2] = $rowid32[1]; $Fi009[$i2] = $rowid32[2]; $Fi010[$i2] = $rowid32[3];
				$Fi011[$i2] = $rowid32[4]; $Fi012[$i2] = $rowid32[5]; $Fi013[$i2] = $rowid32[6]; $Fi014[$i2] = $rowid32[7];
				$Fi015[$i2] = $rowid32[8]; $Fi016[$i2] = $rowid32[9];
				$Fi017[$i2] = $Fi007[$i2] + $Fi008[$i2] + $Fi009[$i2] + $Fi010[$i2] + $Fi011[$i2] + $Fi012[$i2] + $Fi013[$i2] + $Fi014[$i2];
				$Fi018[$i2] = $rowid32[10]; $Fi019[$i2] = $rowid32[11];
			}
			$i2++;
		}		
	}
?>
<?php if($i2 > 0)  { ?>
<div class="row">
<div class="col-xs-12">
<div class="box">   
<div id="table_wrapper">
<div class="box-body table-responsive no-padding">
<table class="table table-bordered" border="1">
<thead>
<tr>
    <th rowspan="3">S.N.</th>
    <th rowspan="3">&nbsp;Block</th>
    <th rowspan="3">&nbsp;Project Village</th>
    <th rowspan="3">&nbsp;Group Name</th>
    <th rowspan="3">Date of Formation</th>
    <th rowspan="3">Meeting Dates</th>
    <th colspan="11">Total Members</th>
    <th colspan="2" rowspan="2">How many members joined &amp; left the group</th>
  </tr>
  <tr>
    <th colspan="2">General</th>
    <th colspan="2">SC</th>
    <th colspan="2">ST</th>
    <th colspan="2">OBC</th>
    <th rowspan="2">APL</th>
    <th rowspan="2">BPL</th>
    <th rowspan="2">Total<br />(7 to 14)</th>
  </tr>
  <tr>
    <th>M</th>
    <th>F</th>
    <th>M</th>
    <th>F</th>
    <th>M</th>
    <th>F</th>
    <th>M</th>
    <th>F</th>
    <th>Joined</th>
    <th>Left</th>
  </tr>
  <tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    <th>4</th>
    <th>5</th>
    <th>6</th>
    <th>7</th>
    <th>8</th>
    <th>9</th>
    <th>10</th>
    <th>11</th>
    <th>12</th>
    <th>13</th>
    <th>14</th>
    <th>15</th>
    <th>16</th>
    <th>17</th>
    <th>18</th>
    <th>19</th>
  </tr>
</thead> 
<?php for($j1 = 0; $j1 < $i2; $j1++) { 
	if($Fi007[$j1] == 0) { $Fi007[$j1] = '';}
	if($Fi008[$j1] == 0) { $Fi008[$j1] = '';}
	if($Fi009[$j1] == 0) { $Fi009[$j1] = '';}
	if($Fi010[$j1] == 0) { $Fi010[$j1] = '';}
	if($Fi011[$j1] == 0) { $Fi011[$j1] = '';}
	if($Fi012[$j1] == 0) { $Fi012[$j1] = '';}
	if($Fi013[$j1] == 0) { $Fi013[$j1] = '';}
	if($Fi014[$j1] == 0) { $Fi014[$j1] = '';}
	if($Fi015[$j1] == 0) { $Fi015[$j1] = '';}
	if($Fi016[$j1] == 0) { $Fi016[$j1] = '';}
	if($Fi017[$j1] == 0) { $Fi017[$j1] = '';}
	if($Fi018[$j1] == 0) { $Fi018[$j1] = '';}
	if($Fi019[$j1] == 0) { $Fi019[$j1] = '';}
?>
  <tr>
    <td><?=$j1+1?></td>
    <td><?=$F02[$j1]?></td>
    <td><?=$F07[$j1]?></td>
    <td><?=$F05[$j1]?></td>
    <td><?=$Fi005[$j1]?></td>
    <td><?=$Fi006[$j1]?></td>
    <td><?=$Fi007[$j1]?></td>
    <td><?=$Fi008[$j1]?></td>
    <td><?=$Fi009[$j1]?></td>
    <td><?=$Fi010[$j1]?></td>
    <td><?=$Fi011[$j1]?></td>
    <td><?=$Fi012[$j1]?></td>
    <td><?=$Fi013[$j1]?></td>
    <td><?=$Fi014[$j1]?></td>
    <td><?=$Fi015[$j1]?></td>
    <td><?=$Fi016[$j1]?></td>
    <td><?=$Fi017[$j1]?></td>
    <td><?=$Fi018[$j1]?></td>
    <td><?=$Fi019[$j1]?></td>
  </tr>
<?php
	$Sum7 += $Fi007[$j1]; $Sum8 += $Fi008[$j1]; $Sum9 += $Fi009[$j1]; $Sum10 += $Fi010[$j1];
	$Sum11 += $Fi011[$j1]; $Sum12 += $Fi012[$j1]; $Sum13 += $Fi013[$j1]; $Sum14 += $Fi014[$j1];
	$Sum15 += $Fi015[$j1]; $Sum16 += $Fi016[$j1]; $Sum17 += $Fi017[$j1]; $Sum18 += $Fi018[$j1];
	$Sum19 += $Fi019[$j1];
?>				
<?php } ?>
<?php
	if($Sum7 == 0) { $Sum7 = '';}
	if($Sum8 == 0) { $Sum8 = '';}
	if($Sum9 == 0) { $Sum9 = '';}
	if($Sum10 == 0) { $Sum10 = '';}
	if($Sum11 == 0) { $Sum11 = '';}
	if($Sum12 == 0) { $Sum12 = '';}
	if($Sum13 == 0) { $Sum13 = '';}
	if($Sum14 == 0) { $Sum14 = '';}
	if($Sum15 == 0) { $Sum15 = '';}
	if($Sum16 == 0) { $Sum16 = '';}
	if($Sum17 == 0) { $Sum17 = '';}
	if($Sum18 == 0) { $Sum18 = '';}
?>
  <tr>
    <td colspan="6">Total</td>
    <td><?=$Sum7?></td>
    <td><?=$Sum8?></td>
    <td><?=$Sum9?></td>
    <td><?=$Sum10?></td>
    <td><?=$Sum11?></td>
    <td><?=$Sum12?></td>
    <td><?=$Sum13?></td>
    <td><?=$Sum14?></td>
    <td><?=$Sum15?></td>
    <td><?=$Sum16?></td>
    <td><?=$Sum17?></td>
    <td><?=$Sum18?></td>
    <td><?=$Sum19?></td>
  </tr>
</table>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<p align="left" size="2">&nbsp;&nbsp;ILSP-MIS&nbsp;&nbsp;[*based on MIS Data]&nbsp;&nbsp;<?php Echo $UserName2; ?>
&nbsp;&nbsp;<?php $CTCTCT = date('Y-m-d H:i:s'); Echo $CTCTCT; ?>&nbsp;&nbsp;<?php Echo $ipaddress; ?> &nbsp;&nbsp;
<a href="#" onClick="window.print();" class="btn btn-default"><i class="fa fa-print"></i> Print</a>
</p>
<?php include('ILSP_Main2.php'); ?>

Telling us something is not working is pointless. We are not there with you and don’t know what you saw that leads you to believe it didn’t work. You have to provide information about what it did do, even if it was just a blank page. Also, a bunch of uncommitted code using cryptic variable names won’t get you much help because no one it going to take the time to figure out what everything is trying to accomplish. Write well commented code with variable names that indicate the meaning of the data in the variable.

Next, the mysql_ extension has been removed from php for some time now, so the code won’t even run under current php versions. You would need to convert the code to use the modern PDO extension.

Lastly, wherever you pasted this from lost some of the formatting. Post the original code using bbocde code tags - [code] your code here... [/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service