<?php
$name=$_POST["name"];
$lastname=$_POST["lastname"];
$sbj1=$_POST["sbj1"];
$sbj2=$_POST["sbj2"];
$sbj3=$_POST["sbj3"];
$sbj4=$_POST["sbj4"];
$cred1=$_POST["cred1"];
$cred2=$_POST["cred2"];
$cred3=$_POST["cred3"];
$cred4=$_POST["cred4"];
$grade1=$_POST["grade1"];
$grade2=$_POST["grade2"];
$grade3=$_POST["grade3"];
$grade4=$_POST["grade4"];
$setsbj="";
$setcred="";
$gpa="";
if($grade1=='A'||'a'){
echo "4";
}
else if($grade1=='B+'||'b+'){
echo "3.5";
}
else if($grade1=='B'|| 'b'){
echo "3";
}
else if($grade1=='C+'||'c+'){
echo "2.5";
}
else if($grade1=='C'||'c'){
echo "2";
}
else if($grade1=='D+'||'d+'){
echo "1.5";
}
else if($grade1=='D'||'d'){
echo "1";
}
else if($grade1=='F'||'f'){
echo "0";
}
if($grade2=='A'||'a'){
echo "4";
}
else if($grade2=='B+'||'b+'){
echo "3.5";
}
else if($grade2=='B'|| 'b'){
echo "3";
}
else if($grade2=='C+'||'c+'){
echo "2.5";
}
else if($grade2=='C'||'c'){
echo "2";
}
else if($grade2=='D+'||'d+'){
echo "1.5";
}
else if($grade2=='D'||'d'){
echo "1";
}
else if($grade2=='F'||'f'){
echo "0";
}
if($grade3=='A'||'a'){
echo "4";
}
else if($grade3=='B+'||'b+'){
echo "3.5";
}
else if($grade3=='B'|| 'b'){
echo "3";
}
else if($grade3=='C+'||'c+'){
echo "2.5";
}
else if($grade3=='C'||'c'){
echo "2";
}
else if($grade3=='D+'||'d+'){
echo "1.5";
}
else if($grade3=='D'||'d'){
echo "1";
}
else if($grade3=='F'||'f'){
echo "0";
}
if($grade4=='A'||'a'){
echo "4";
}
else if($grade4=='B+'||'b+'){
echo "3.5";
}
else if($grade4=='B'|| 'b'){
echo "3";
}
else if($grade4=='C+'||'c+'){
echo "2.5";
}
else if($grade4=='C'||'c'){
echo "2";
}
else if($grade4=='D+'||'d+'){
echo "1.5";
}
else if($grade4=='D'||'d'){
echo "1";
}
else if($grade4=='F'||'f'){
echo "0";
}
$sbj1=$cred1*$grade1;
echo "$sbj1";
$sbj2=$cred2*$grade2;
echo "$sbj2";
$sbj3=$cred3*$grade3;
echo "sbj3";
$sbl4=$cred4*$grade4;
echo "sbj4";
$setsbj=$sbj1+$sbj2+$sbj3+$sbj4;
$setcred=$cred1+$cred2+$cred3+$cred4;
$gpa=$setsbj%$setcred;
echo "$gpa";
?>
ช่วยดูโค้ดนี้ให้หน่อยครับ จนปัญญาละ
$name=$_POST["name"];
$lastname=$_POST["lastname"];
$sbj1=$_POST["sbj1"];
$sbj2=$_POST["sbj2"];
$sbj3=$_POST["sbj3"];
$sbj4=$_POST["sbj4"];
$cred1=$_POST["cred1"];
$cred2=$_POST["cred2"];
$cred3=$_POST["cred3"];
$cred4=$_POST["cred4"];
$grade1=$_POST["grade1"];
$grade2=$_POST["grade2"];
$grade3=$_POST["grade3"];
$grade4=$_POST["grade4"];
$setsbj="";
$setcred="";
$gpa="";
if($grade1=='A'||'a'){
echo "4";
}
else if($grade1=='B+'||'b+'){
echo "3.5";
}
else if($grade1=='B'|| 'b'){
echo "3";
}
else if($grade1=='C+'||'c+'){
echo "2.5";
}
else if($grade1=='C'||'c'){
echo "2";
}
else if($grade1=='D+'||'d+'){
echo "1.5";
}
else if($grade1=='D'||'d'){
echo "1";
}
else if($grade1=='F'||'f'){
echo "0";
}
if($grade2=='A'||'a'){
echo "4";
}
else if($grade2=='B+'||'b+'){
echo "3.5";
}
else if($grade2=='B'|| 'b'){
echo "3";
}
else if($grade2=='C+'||'c+'){
echo "2.5";
}
else if($grade2=='C'||'c'){
echo "2";
}
else if($grade2=='D+'||'d+'){
echo "1.5";
}
else if($grade2=='D'||'d'){
echo "1";
}
else if($grade2=='F'||'f'){
echo "0";
}
if($grade3=='A'||'a'){
echo "4";
}
else if($grade3=='B+'||'b+'){
echo "3.5";
}
else if($grade3=='B'|| 'b'){
echo "3";
}
else if($grade3=='C+'||'c+'){
echo "2.5";
}
else if($grade3=='C'||'c'){
echo "2";
}
else if($grade3=='D+'||'d+'){
echo "1.5";
}
else if($grade3=='D'||'d'){
echo "1";
}
else if($grade3=='F'||'f'){
echo "0";
}
if($grade4=='A'||'a'){
echo "4";
}
else if($grade4=='B+'||'b+'){
echo "3.5";
}
else if($grade4=='B'|| 'b'){
echo "3";
}
else if($grade4=='C+'||'c+'){
echo "2.5";
}
else if($grade4=='C'||'c'){
echo "2";
}
else if($grade4=='D+'||'d+'){
echo "1.5";
}
else if($grade4=='D'||'d'){
echo "1";
}
else if($grade4=='F'||'f'){
echo "0";
}
$sbj1=$cred1*$grade1;
echo "$sbj1";
$sbj2=$cred2*$grade2;
echo "$sbj2";
$sbj3=$cred3*$grade3;
echo "sbj3";
$sbl4=$cred4*$grade4;
echo "sbj4";
$setsbj=$sbj1+$sbj2+$sbj3+$sbj4;
$setcred=$cred1+$cred2+$cred3+$cred4;
$gpa=$setsbj%$setcred;
echo "$gpa";
?>