<?php
session_start();
require_once "../config.php";

$student_name = $_SESSION['student_name'];
$class = $_SESSION['class'];
$track_id = $_POST['track_id'];
$challenge_no = $_POST['challenge_no'];

$stmt = $conn->prepare(
    "INSERT INTO coding_submissions
     (student_name, class, track_id, challenge_no)
     VALUES (?, ?, ?, ?)"
);
$stmt->bind_param("ssii", $student_name, $class, $track_id, $challenge_no);
$stmt->execute();

header("Location: track_challenges.php?track_id=$track_id");
exit;
