dbayo 0 Newbie Poster

hello..i need a help for math function..when i try to add multiple number in php..the value that return to me is array..below is my code..can anyone help me..

<?php
$Final2=null;
$gred=null;


	 
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("kptm", $con);
$result = mysql_query("SELECT NAMA FROM student ORDER BY NAMA");

$i=0;

$Nama=$_POST["nama"];
$Ujian1=$_POST["ujian1"];

$Ujian2=$_POST["ujian2"];

$Tugasan=$_POST["tugasan"];

$Kuiz=$_POST["kuiz"];
$Final=$_POST["final"];





$Carry= $Ujian1+$Ujian2+$Tugasan+$Kuiz;
$Final2= $Carry+$Final;

   
echo"<form name='kptm' form method='POST' action='3.php'>";
echo"<h1 align='center'> final result</h1>";



   echo"<table border='2'align='center'>";
  echo"<p align='center'>SUBJEK : SISTEM UNIX (TK 213)";
  echo "<tr> ";
     echo"<p align='center'>";
   echo"<td width='20'>Bil";
  echo"<td width='230'> Nama Pelajar";
  echo"<td width='80'> UJIAN 1 &nbsp&nbsp n/15";
  echo"<td width='80'> UJIAN 2 &nbsp&nbsp  n/15";
  echo"<td width='90'> TUGASAN &nbsp&nbsp  n/15";
  echo"<td width='70'> KUIZ &nbsp&nbsp  n/5";
  echo"<td width='70'> CARRY MARK &nbsp&nbsp n/50";
  echo"<td width='60'> Final Exam &nbsp&nbsp  n/50";
  echo"<td width='60'> Jumlah &nbsp&nbsp  n/100";
    echo"<td width='60'> Gred ";
  echo"</tr>";
  echo"</table>";
  

$bil2=0;

  echo"<table border='2'align='center'>";
  while ($row = mysql_fetch_array($result)) 
{   
$i++;
$bil2++;

	echo "<tr> ";
 
  $Nama = $row["NAMA"];
 

 
  if (($Final2 > 0) && ($Final2 <= 39))
	  {
	  $gred='F';
	  }
 else if (($Final2 >= 40 ) && ($Final2 <= 49))
	  {
	  $gred='D';
	  }
 else if (($Final2 >= 50) && ($Final2 <= 54))
	  {
	  $gred='C+';
	  }
 else if (($Final2 >=55) && ($Final2 <= 59))
	  {
	 $gred='C';
	  }  
 else if (($Final2 >= 60) && ($Final2 <= 64))
	  {
	  $gred='B-';
	  }
 else if (($Final2 >=65) && ($Final2 <= 69))
	  {
	  $gred='B';
	  }
 else if (($Final2 >=70) && ($Final2 <= 74))
	  {
	  $gred='B+';
	  }
 else if (($Final2 > 74) && ($Final2 <85))
	  {
	  $gred= 'A-';
	  }
 else if(($Final2 > 85) && ($Final2 <= 100))
	 {
	 $gred='A';
	 }
	

   echo "<tr> ";
  

   echo"<td width='18'>$i";

   echo"<td width='230'><input type=text name=nama".$i." value='$Nama' size=34 max length=5  >\t ";
    echo"<td width='80'><input type=text name=ujian1".$i." value='$Ujian1[$i]' size=10 max length=5  >\t ";
    echo"<td width='80'><input type=text name=ujian2".$i." value='$Ujian2[$i]'size=9 max length=5 >\t ";
   echo"<td width='90'><input type=text name=tugasan".$i." value='$Tugasan[$i]'size=11 max length=5 >\t ";
     echo"<td width='70'><input type=text name=kuiz".$i." value='$Kuiz[$i]'size=6 max length=5  >\t ";
   echo"<td width='70'><input type=text name=carry".$i." value='$Carry' size=8 ><br/> ";
     echo"<td width='60'><input type=text name=final value='$Final[$i]' size=6 ><br/> ";
      echo"<td width='60'><input type=text name=final2 value='$Final2' size=6 ><br/> ";
	    echo"<td width='60'><input type=text name=gred value='$gred' size=6 ><br/> ";
		
   echo"</tr>";
   
   echo"</tr>";
 
}
   echo"</table>";
       
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.