function savegrade()
{
    if (isset($_POST['savegrades'])) {
        if ($_POST['finalave'] >= 75 and $_POST['finalave'] <= 100) {
            $remarks = "Passed";
        } else {
            $remarks = "Failed";
        }
        $instClass = new InstructorClasses();
        $cur = $instClass->single_class($_GET['classId']);
        $grade = new Grades();
        $grade->INST_ID = $cur->INST_ID;
        $grade->FIRST = $_POST['first'];
        $grade->SECOND = $_POST['second'];
        $grade->THIRD = $_POST['third'];
        $grade->FOURTH = $_POST['fourth'];
        $grade->AVE = $_POST['finalave'];
        $grade->REMARKS = $remarks;
        $grade->update($_GET['gradeId']);
        message("Grade successfully updated!");
        redirect("index.php?view=class&id=" . $_GET['classId'] . "&instructorId=" . $_GET['instructorId'] . "");
    }
}
if (isset($_POST['savegrades'])) {
    if ($_POST['finalave'] >= 75 and $_POST['finalave'] <= 100) {
        $remarks = "Passed";
    } else {
        $remarks = "Failed";
    }
    $instClass = new InstructorClasses();
    $cur = $instClass->single_class($_GET['classId']);
    $grade = new Grades();
    $grade->INST_ID = $cur->INST_ID;
    $grade->PRE = $_POST['prelim'];
    $grade->MID = $_POST['midterm'];
    $grade->FIN = $_POST['final'];
    $grade->FIN_AVE = $_POST['finalave'];
    $grade->REMARKS = $remarks;
    $grade->update($_GET['gradeId']);
    message("");
    redirect("instructorClasses.php?classId=" . $_GET['classId'] . "");
}
?>
		
		
		 
		        <form class="form-horizontal well span4" action="?classId=<?php 
echo $_GET['classId'];
?>
&gradeId=<?php 
echo $_GET['gradeId'];
?>
" method="POST">