<?php
// Include database connection code
include("includes/db.php");

if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["subjectId"])) {
    $subjectId = $conn->real_escape_string($_POST["subjectId"]);

    // Fetch theory full marks for the selected subject from the subjects table
    $query = "SELECT theory_full_marks FROM subjects WHERE id = '$subjectId'";
    $result = $conn->query($query);

    if ($result->num_rows > 0) {
        $row = $result->fetch_assoc();
        $theoryFullMarks = $row["theory_full_marks"];
        echo  "Theory Full Marks: ".$theoryFullMarks;
    } else {
        // If subject not found or theory full marks are not available, send "N/A" as response
        echo "N/A";
    }
} else {
    // If subjectId is not received properly, send "N/A" as response
    echo "N/A";
}

// Close the database connection
$conn->close();
?>
