Form error“; echo “
Sorry, there was a problem:
“; foreach ($errors as $e) echo “- “.htmlspecialchars($e).”
“; echo “
Go back and try again
“; exit; } // Build email bodies $dayList = !empty($days) ? implode(‘, ‘, $days) : ‘—’; $adminSubject = “New booking request: $service from $name”; $adminBody = <<\r\n” . “Reply-To: {$name} <{$email}>\r\n”; // For customer ack: From is the site; Reply-To is the site $customerHeaders = $commonHeaders . “From: {$siteName} <{$fromEmail}>\r\n” . “Reply-To: {$siteName} <{$fromEmail}>\r\n”; // Send emails (two separate messages) $ok1 = @mail($adminEmail, $adminSubject, $adminBody, $adminHeaders); $ok2 = @mail($email, $customerSubject, $customerBody, $customerHeaders); // Simple thank-you page echo “
Thank you“; if ($ok1 && $ok2) { echo “
“; echo “
Thanks, {$name}!
“; echo “
Your booking request has been sent. We’ll email you shortly to confirm a time slot.
“; echo “
← Back to the form
“; echo “
“; } else { http_response_code(500); echo “
“; echo “
Something went wrong
“; echo “
Sorry, we couldn’t send the emails just now. Please try again or contact us directly.
“; echo “
← Back to the form
“; echo “
“; }