hi all ,the code i write below display report on selection of some field below it.my problem is that i want to print this report but controls are also printing with report.i want that only report will print.
please help me to solve my problem............can i transfer report to other page ?

from rohit

<html>
<head>
<title></title>
</head>
<body>
<table bgcolor="#FFFFFF" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td colspan="10"><div align="center">
  <span class="style2">hhh</span></div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="7%">&nbsp;</td>
    <td width="7%">&nbsp;</td>
    <td width="18%">&nbsp;</td>
    <td width="4%">&nbsp;</td>
    <td width="17%">&nbsp;</td>
    <td width="3%">&nbsp;</td>
    <td width="22%">&nbsp;</td>
    <td width="4%">&nbsp;</td>
    <td width="16%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
  </tr>
<form name="form"  id="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

  <tr>
    <td></td>
    <td><strong>Division</strong></td>
    <td>
    <strong>
<?php
  include("../dbcon.php");
  $objdb=new Dbcon();
  $host=$objdb->host;
  $user=$objdb->user;
  $pass1=$objdb->pass;
  $db=$objdb->db;

  mysql_connect($host,$user,$pass1) or die("could not connect:".mysql_error());
  mysql_select_db($db);
$divname=$_POST['txtdiv'];
  $qur = mysql_query("select distinct(division) from div_gp")
  or die("Invalid query: ".mysql_error());

  echo '<select id="txtdiv" name="txtdiv" onchange="ref()">';
  echo '<option value="">Select..</option>';
  while ($row = mysql_fetch_array($qur)) 
  {
		 $va1 = $row['division'];
		 if(isset($_POST['txtdiv']) )
		 { 
			if($va1==$_POST['txtdiv'])
			{
				echo "<option value='$va1' selected>$va1</option>";
			}
			else
			{
				echo "<option value='$va1'>$va1</option>";
			}
		}
		else
		 {	
			echo "<option value='$va1'>$va1</option>";
		 }	
	}
echo '</select>';
?>
    </strong></td>
    <td><strong>Unit</strong></td>
    <td><span class="style121">
<?php	

$div=$_POST['txtdiv']; 
if(isset($div) and strlen($div) > 0)
{
  $res = mysql_query("SELECT distinct(untcode) FROM div_gp where division='$div'")
  or die("Invalid query: " . mysql_query());
  echo '<select id="txtunt" name="txtunt" onchange="ref()">';
  echo '<option value="">Select..</option>';
  while ($row = mysql_fetch_array($res)) 
  {
		 $va1 = $row['untcode'];
		 if(isset($_POST['txtunt']) )
		 { 
			if($va1==$_POST['txtunt'])
			{
			echo "<option value='$va1' selected>$va1</option>";
			}
			else
			{
				echo "<option value='$va1' >$va1</option>";
			}
		}
		else
		 {	
			echo "<option value='$va1' >$va1</option>";
		 }	
	}
echo '</select>';
}
else
{

}
?>
    </span></td>
    <td><strong>GP</strong></td>
    <td><span class="style121">

<?php	
$gp=$_POST['txtunt'];
//echo"$cat";
if(isset($gp) and strlen($gp) > 0)
{
  $res = mysql_query("SELECT gp,gpid FROM div_gp where untcode='$gp'")
  or die("Invalid query: " . mysql_query());
  echo '<select class="style23" id="txtgp" name="txtgp" >';
  echo '<option value="">Select..</option>';
  while ($row = mysql_fetch_array($res)) 
  {
		 $va1 = $row['gp'];
		 $va2 = $row['gpid'];
		 if(isset($_POST['txtgp']) )
		 { 
			if($va2==$_POST['txtgp'])
			{
			echo "<option value='$va2' selected>$va1</option>";
			}
			else
			{
				echo "<option value='$va2' >$va1</option>";
			}
		}
		else
		 {	
			echo "<option value='$va2' >$va1</option>";
		 }	
	}
echo '</select>';
}
else
{
}
?>

    </span></td>
    <td><strong>Year</strong></td>
    <td>
<?php
$arryear=array('2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014');
  echo "<select class=\"style23\" id=\"ddyr\" name=\"ddyr\">";
  echo "<option value=\"\">Select..</option>";

if(isset($_POST['ddyr']) )
{ 
	$selddyr=$_POST['ddyr'];	 
	foreach($arryear as $y)
	{
	  	if($y==$selddyr)
		
		  echo "<option value=\"$y\" selected>$y</option>";
		else
		   echo "<option value=\"$y\">$y</option>";
	}
}	
else
{
	foreach($arryear as $y)
	{
		echo "<option value=\"$y\">$y</option>";
	}
}
  echo "</select>";
?></td>
  <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><strong>Report Level&nbsp;&nbsp; <span class="style4">
<?php
  $arrval=array('GP Level','Unit Level','Division Level');
  echo "<select class=\"style23\" id=\"val\" name=\"val\">";
  echo "<option value=\"\">Select..</option>";

	if(isset($_POST['val']) )
	{ 
	$selddmonth=$_POST['val'];	 
	foreach($arrval as $m)
	{
	  	if($m==$selddmonth)
		  echo "<option value=\"$m\" selected>$m</option>";
		else
		   echo "<option value=\"$m\">$m</option>";
	}
	}
	else
	{
	foreach($arrval as $m)
	{
  		echo "<option value=\"$m\">$m</option>";
  	}
	}
	echo "</select>";
?>
   </span></strong></td>
   <td></td>
   <td colspan="3">
   <span class="style121">
   <input name="btshow" id="btshow" onClick="sel()" type="submit" class="style121" value=" Show " />
   </span>
   <span class="style121">
     <input name="btcum" id="btcum" onChange="sel()" type="submit" class="style121" value=" Cumulative " />
   </span></td>
   <td colspan="2">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </form>
  <tr>
  <form name="form1" id="form1" method="post" action="printgpwd.php?name=<?php echo $divname;?>">
<?php
  	$divname=$_POST['txtdiv'];
?>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12%">&nbsp;</td>
        <td width="63%">&nbsp;</td>
        <td width="25%"><span class="style121">
<input name="btprint" id="btprint" onClick="window.print();return false;" type="submit" class="style121" value="   Print   " />
    </span></td>
    </tr>
    </table></td>
    <td>&nbsp;</td>
	</form>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td colspan="6">	</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="9">
	  <div align="center">
  <?php 
if(isset($_POST['btshow']))
{
$val=$_POST['val'];
if($val=='GP Level')
{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];

		$qur1="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID='$txtgp' and tactivity .FinYr='$ddyr')
GROUP BY reportgpwd.Activity  UNION
SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID = '$txtgp' and tactivity .FinYr='$ddyr') UNION
SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID = '$txtgp'
AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur1";
		//echo("<input type=\"text\" id=\"hidgpyr\" name=\"hidgpyr\" value=\"$qur1\">");
		$result=mysql_query($qur1) or die(mysql_error());
		//$row = mysql_fetch_row($result);
		//$total_records = $row[0];
		echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
	echo("<tr bgcolor='#BEBEBE'>");
	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical <br> &nbsp;Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;&nbsp;A&nbsp;&nbsp;</th><th>&nbsp;&nbsp;B&nbsp;&nbsp;</th><th>&nbsp;&nbsp;C&nbsp;&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth=$row['Oth'];
				$SCST=$row['SCST'];
				$Total=$row['Total'];

				$Male =$row['Male'];
				$Female =$row['Female'];

				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");
			}
			echo("</table>");
	}
	elseif($val=='Unit Level')
	{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];

		$qur2="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where untcode='$txtunt' ) and tactivity .FinYr='$ddyr')
GROUP BY reportgpwd.Activity  UNION 
SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where untcode='$txtunt' and tactivity .FinYr='$ddyr')) UNION
SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where untcode='$txtunt') AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur";
		$result=mysql_query($qur2) or die(mysql_error());
		echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
		echo("<tr bgcolor='#BEBEBE'>");
	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");	
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth =$row['Oth'];
				$SCST  =$row['SCST'];
				$Total =$row['Total'];

				$Male =$row['Male'];
				$Female =$row['Female'];

				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");
			}
			echo("</table>");		
	}
	elseif($val=='Division Level')
	{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];

		$qur3="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where division='$div') and tactivity .FinYr='$ddyr')
GROUP BY reportgpwd.Activity UNION 
SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where division='$div' and tactivity .FinYr='$ddyr'))UNION 
SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where division='$div') AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur";
		$result=mysql_query($qur3) or die(mysql_error());
		
		echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
		echo("<tr bgcolor='#BEBEBE'>");
	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");	
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth =$row['Oth'];
				$SCST  =$row['SCST'];
				$Total =$row['Total'];

				$Male =$row['Male'];
				$Female =$row['Female'];

				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");
			}
			echo("</table>");		
	}
}
else
{
}
?>
  </div></td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td colspan="9"><div align="center">
  <?php 
if(isset($_POST['btcum']))
{
$val=$_POST['val'];
if($val=='GP Level')
{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];
		
		$qur4="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID='$txtgp')
GROUP BY reportgpwd.Activity UNION 
SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID = '$txtgp') UNION 
SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID = '$txtgp') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur";
		$result=mysql_query($qur4) or die(mysql_error());
echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
		echo("<tr bgcolor='#BEBEBE'>");

	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth =$row['Oth'];
				$SCST  =$row['SCST'];
				$Total =$row['Total'];

				$Male =$row['Male'];
				$Female =$row['Female'];

				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");				
			}
			echo("</table>");
	}
	elseif($val=='Unit Level')
	{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];
		
		$qur5="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where untcode='$txtunt'))
GROUP BY reportgpwd.Activity UNION 
SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where untcode='$txtunt')) UNION
SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where untcode='$txtunt')) group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur";
		$result=mysql_query($qur5) or die(mysql_error());
		
		echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
		echo("<tr bgcolor='#BEBEBE'>");
	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");	
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth =$row['Oth'];
				$SCST  =$row['SCST'];
				$Total =$row['Total'];

				$Male =$row['Male'];
				$Female =$row['Female'];

				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");
			}
			echo("</table>");		
	}
	elseif($val=='Division Level')
	{
		$div=$_POST['txtdiv'];
		$txtgp=$_POST['txtgp'];
		$txtunt=$_POST['txtunt'];
		$ddyr=$_POST['ddyr'];
		
		$qur6="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson' FROM reportgpwd LEFT OUTER JOIN tactivity  ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where division='$div'))GROUP BY reportgpwd.Activity UNION                                             SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where division='$div')) UNION SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson                 FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where division='$div')) group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
		//echo"$qur";
		$result=mysql_query($qur6) or die(mysql_error());
		
echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
	echo("<tr bgcolor='#BEBEBE'>");
	echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
			echo("</tr>");	
			while($row=mysql_fetch_array($result,MYSQL_ASSOC))
			{
				$Activity=$row['Activity'];
				$unit=$row['unit'];
				$pshare=$row['PShare'];
				$BShare =$row['BShare'];
				$BenFamily =$row['BenFamily'];
				$pachv=$row['PAchv'];
				$BPL=$row['BPL'];
				$Oth =$row['Oth'];
				$SCST  =$row['SCST'];
				$Total =$row['Total'];
				$Male =$row['Male'];
				$Female =$row['Female'];
				$TotalPerson =$row['TotalPerson'];

				echo("<tr>");
				echo("<td>$Activity</td>");
				echo("<td align=right>$unit</td>");
				echo("<td align=right>$pachv</td>");
				echo("<td align=right>$pshare</td>");
				echo("<td align=right>$BShare</td>");
				echo("<td align=right>$BenFamily </td>");
				echo("<td align=right>$BPL</td>");
				echo("<td align=right>$Oth</td>");
				echo("<td align=right>$SCST</td>");
				echo("<td align=right>$Total</td>");
				echo("<td align=right>$Male</td>");
				echo("<td align=right>$Female</td>");
				echo("<td align=right>$TotalPerson</td>");
				echo("</tr>");
			}
			echo("</table>");		
	}
}
else
{
}
?>
  </div></td>
  <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<script language="javascript">
function ref()
{
	document.form.submit();
}
function sel()
{

}
</script>

If you just want to prevent page elements such as buttons from displaying on printed output, the easiest way to do that is by using external stylesheets. You can use a different stylesheet to format what displays on the screen versus what is printed.

Here is a article that shows you how to do it:

Formatting Printed Web Pages With CSS

If you are trying to prevent the date, page URL and other information from printing at the top and bottom of a printed page, you have to turn that off in your browser. You cannot do it with web page code.

In Internet Explorer, go to File > Page Setup. Just remove the code in the Header and Footer sections.

actually there is two button in my page one is for show report and second is for cummulative report.is there any way that my report when i click show button it display in other page not in same page.

use this code:

<a href="javascript:;" onClick="window.open('yourpage.php?id=<?=$row['reportid'];?>','no','scrollbars=yes,width=600,height=550')" >View</a>

how can i get report id ? i am little bit confuse because there are approximate 6 query in my page for generating report.

well, it looks fine , let me run this code on my PC and I will let you know about the problem if i will be able to track it

This article has been dead for over six months. Start a new discussion instead.