process-order


text/x-generic process-order.php ( PHP script, ASCII text )
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Collect form data
    $name = $_POST["name"];
    $email = $_POST["email"];
    // Collect other form fields here...

    // Email content
    $to = "[email protected]"; // Your email address
    $subject = "New Order";
    $message = "Name: " . $name . "\r\n";
    $message .= "Email: " . $email . "\r\n";
    // Include other form data in the message...

    // Additional headers
    $headers = "From: " . $email . "\r\n";
    $headers .= "Reply-To: " . $email . "\r\n";
    $headers .= "X-Mailer: PHP/" . phpversion();

    // Send email to you
    mail($to, $subject, $message, $headers);

    // Send confirmation email to customer
    $customer_subject = "Order Confirmation";
    $customer_message = "Thank you for your order. We will reach out to you shortly for confirmation.";
    mail($email, $customer_subject, $customer_message, $headers);

    // Send response to AJAX request
    http_response_code(200);
    echo "success";
} else {
    // Send response to AJAX request
    http_response_code(403);
    echo "error";
}
?>
Scroll to Top