Version: 1.2

Type: Full Script

Category: Other

License: Other

Description: This is shows you a bar graph in % in each row. Down load two files and one picture. If 'U' hav any problem mail at himadrish@yahoo.com.



<?php
	$firstval=$one;
	$secondval=$two;
	$thirdval=$three;
	$four=$four;
	
	$TotalAmount=$firstval+$secondval+$thirdval+$four;
	
	$percentageOne=(($firstval/$TotalAmount)*100);
	$percentageOne=round($percentageOne,0);

	$percentageTwo=(($secondval/$TotalAmount)*100);
	$percentageTwo=round($percentageTwo,0);
	
	$percentageThree=(($thirdval/$TotalAmount)*100);
	$percentageThree=round($percentageThree,0);
	
	$percentageFour=(($four/$TotalAmount)*100);
	$percentageFour=round($percentageFour,0);
	
	echo "<html><title>Php Graph</title><body><center>";
	echo "<br><br>$one&nbsp;&nbsp;$two&nbsp;&nbsp;$three&nbsp;&nbsp;$four&nbsp;&nbsp;<br>";
	// echo "<br><br><image src='phutki.jpg'><br>$percentageOne";
	// echo "<br><br><image src='phutki.jpg'><br>$percentageTwo";
	// echo "<br><br><image src='phutki.jpg'><br>$percentageThree";
	// echo "<br><br><image src='phutki.jpg'><br>$percentageFour";
	
	if($graphtype=="bar")
	{
//******************************Bar Graph Strat**************************************
	echo "<div align='center'><center>";
	echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
	echo "<tr><td width='100%'></td></tr>";
	echo "<tr><td width='$percentageOne%'><font color='red'>$percentageOne&nbsp;<font color='green' size='1'>(%)<img border='1' src='phutki.jpg' width='$percentageOne;%' height='4'></td></tr>";
	echo "<tr><td width='$percentageTwo%'><font color='red'>$percentageTwo&nbsp;<font color='green' size='1'>(%)<img border='1' src='phutki.jpg' width='$percentageTwo;%' height='4'></td></tr>";
	echo "<tr><td width='$percentageThree%>'><font color='red'>$percentageThree&nbsp;<font color='green' size='1'>(%)<img border='1' src='phutki.jpg' width='$percentageThree;%' height='4'></td></tr>";
	echo "<tr><td width='$percentageFour%'><font color='red'>$percentageFour&nbsp;<font color='green' size='1'>(%)<img border='1' src='phutki.jpg' width='$percentageFour;%' height='4'></td></tr>";
	echo "</table>";
	echo "</center></div>";
//******************************Bar Graph End****************************************
	}
	else if($graphtype=="scatter")
	{
//******************************Scatter Graph Strat**************************************
	echo "<b><u>Scatter Graph</u></b><br><br><br><br>";
	echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
	echo "<tr><td width='25%'><img border='1' src='phutki.jpg' width='4%' height='$percentageOne%'></td>";
	echo "<td width='25%'><img border='1' src='phutki.jpg' width='4%' height='$percentageTwo%'></td>";
	echo "<td width='25%'><img border='1' src='phutki.jpg' width='4%' height='$percentageThree%'></td>";
	echo "<td width='25%'><img border='1' src='phutki.jpg' width='4%' height='$percentageFour%'></td></tr>";
	echo "</table>";
//******************************Scatter Graph End****************************************
	}
	else
	{
		echo "You have not chose any graph type";
	}
echo"</center></body></html>";
//$year=2002;
//$retval=days_in_feb($year);
//echo "<br><br>$retval";

// The following functions in PHP return us the last day of the feruary month, and check leap year
function days_in_feb($year){

	//Remember $year must be YYYY.
	
	if ($year < 0) $year++;
	$year += 4800;

    if ( ($year % 4) == 0) {
		if (($year % 100) == 0) {
		    if (($year % 400) == 0) {
				return(29);
		    } else {
				return(28);
		    }
		} else {
		    return(29);
		}
    } else {
		return(28);
    }
}
?>