<?php // /elms/student/program_select.php
declare(strict_types=1);
if (session_status() === PHP_SESSION_NONE) session_start();

$pid  = isset($_GET['program_id']) ? trim($_GET['program_id']) : 'all'; // 'all' or a numeric id
$next = $_GET['next'] ?? '/elms/student/dashboard.php';

if ($pid !== 'all' && !ctype_digit($pid)) $pid = 'all'; // sanitize
$_SESSION['active_program_id'] = $pid;
header('Location: ' . $next);
exit;
