Hello Guys. i need ur help. I want to compute the grades in php. This is My code.
<?php
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("collegestudent") or die(mysql_error());
$id = $_POST['id'];
$prelim = $_POST['prelim'];
$midterm = $_POST['midterm'];
$prefinal = $_POST['prefinal'];
$final = $_POST['final'];
$a = (int) $prelim + 50 * .20;
$b=(int) $midterm + 50 * .20;
$c = (int) $prefinal + 50 * .20;
$d = (int) $final + 50 * .40;
$grades =0;
$grades = (int) $a+(int) $b+(int) $c+(int) $d;
$remarks = "PASS";
$sql="INSERT INTO tblgrade (StudentID, Prelim, Midterm, Pre_Final, Final, Grades, Remarks) VALUES('$id','$midterm','$prefinal','$final', '$grades', '$remarks')";
$query= mysql_query($sql);
mysql_close();
header('location:student_grades.php');
?>
i dont know it correct or wrong.
after computing the grades i want to save it in the database. the problem is If i click save it wont save in database .. what should i do? thanks in advance
more power