prepare($sql); if ($stmt->execute([$survey_id, $email, $satisfaction, $features_str])) { $_SESSION['success_message'] = 'Thank you for your submission!'; header('Location: thank_you.php'); exit; } else { $_SESSION['error_message'] = 'There was an error saving your response. Please try again.'; header('Location: survey.php'); exit; } } catch (PDOException $e) { // In a real app, you would log this error, not show it to the user. error_log('Database Error: ' . $e->getMessage()); $_SESSION['error_message'] = 'A database error occurred. Please try again later.'; header('Location: survey.php'); exit; }