prepare("
INSERT INTO teachers
(institution_id, username, class_handled, password_hash, temp_password, must_change_password)
VALUES (?, ?, ?, ?, ?, 1)
");
try {
$stmt->execute([
$_SESSION['institution_id'],
$username,
$class_handled,
$password_hash,
$tempPassword
]);
$success = "Teacher Created ✅
Username: $username
Password: $tempPassword";
} catch (PDOException $e) {
$error = "Username exists or DB error";
}
}
}
?>
= $success ?>
= $error ?>