<?php
include '../connect.php';
$programId = $_POST['program_id'];
$title = $_POST['title'];
$description = $_POST['description'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$max_capacity = $_POST['max_capacity'];
$classroom_code = $_POST['classroom_code'];
$exam_link = $_POST['exam_link'];
$sql = "UPDATE program SET
        title = '$title',
        description = '$description',
        startDate = '$start_date',
        endDate = '$end_date',
        maxCapacity = '$max_capacity',
        classroomCode = '$classroom_code',
        examLink = '$exam_link'
        WHERE id = $programId";
$result=mysqli_query($con,$sql);
if ($result) {
    // If the update was successful
    echo "Program updated successfully!";
} else {
    // If there was an error with the SQL query
    echo "Error updating program: " . $con->error;
}

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