Pages - Menu

Coding PHP menghitung nilai akhir

<form id="form1" name="form1" method="post" action="">
  <p>Program Menghitung Nilai Akhir</p>
  <table width="390">
    <tr>
      <td width="158">Nilai Quis </td>
      <td width="220"><label>
        <input name="NQ" type="text" id="NQ" />
      </label></td>
    </tr>
    <tr>
      <td>Nilai MID </td>
      <td><input name="NM" type="text" id="NM" /></td>
    </tr>
    <tr>
      <td>Nilai Semesteran </td>
      <td><input name="NS" type="text" id="NS" /></td>
    </tr>
    <tr>
      <td><label>
        <input type="submit" name="Submit" value="Proses" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p></p>
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
$N1=$_POST[NQ];
$N2=$_POST[NM];
$N3=$_POST[NS];

$Nilai=(($N1*20) + ($N2*30) + ($N3*50))/100;
if($Nilai <=100 AND $Nilai >=85)
$NA =”A”;
else if ($Nilai<=84 AND $Nilai>70)
$NA =”B”;
else if ($Nilai<=69 AND $Nilai>60)
$NA =”C”;
else if ($Nilai<=59 AND $Nilai>20)
$NA =”D”;
else
$NA =”E”;
if($_POST[Submit])
{
echo "Nilai Anda Adalah = $Nilai" ;
echo "<br>";
echo "Nilai Hurup = $NA";
}
 ?>

1 komentar: