prepare($sql); $stmt->execute([$title, $description, $status, $priority]); header("Location: tickets.php?success=1"); exit(); } catch (PDOException $e) { header("Location: tickets.php?error=" . urlencode($e->getMessage())); exit(); } } else { header("Location: tickets.php?error=invalid_input"); exit(); } } ?>