query($sql); if ($result->num_rows == 0) { redirect(SITE_URL . '/my-tickets.php'); } $ticket = $result->fetch_assoc(); // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $user_reply = clean_input($_POST['user_reply']); if (empty($user_reply)) { $error = "Please enter your response"; } else { // Append user reply to the message $updated_message = $ticket['message'] . "\n\n--- User Response ---\n" . $user_reply; $updated_message = clean_input($updated_message); // Update ticket with user's response and change status to new $update_sql = "UPDATE contact_messages SET message = '$updated_message', ticket_status = 'new' WHERE id = $ticket_id"; if ($conn->query($update_sql)) { $success = "Your response has been submitted successfully! Our support team will review and respond to your follow-up question."; // Refresh ticket data $result = $conn->query($sql); $ticket = $result->fetch_assoc(); } else { $error = "Failed to submit response. Please try again."; } } } $page_title = 'Respond to Ticket'; include 'includes/header.php'; ?>
📧 What happens next:
Ticket Created:
Replied on:
Follow-up #' . ($index + 1) . ':
' . nl2br(htmlspecialchars($response)) . '
Have additional questions or need clarification? Type your follow-up message below and our support team will respond.