<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Collect form data safely
    $name    = htmlspecialchars($_POST['name']);
    $email   = htmlspecialchars($_POST['email']);
    $phone   = htmlspecialchars($_POST['phone']);
   
    $message = htmlspecialchars($_POST['message']);

    // Email where you want to receive data
    $to = "mimasoftwaregroups@gmail.com";  // <-- change this to your email
    $subject = "New Registration Request from $name";

    $body = "You have received a new registration request:\n\n".
            "Name: $name\n".
            "Email: $email\n".
            "Phone: $phone\n".
           
            "Message: $message\n";

   $headers = "From: noreply@dsnc.ac.in\r\n";
    $headers .= "Reply-To: $email\r\n";

    // Send email
    if (mail($to, $subject, $body, $headers)) {
        echo "Thank you! Your request has been submitted successfully.";
    } else {
        echo "Sorry, something went wrong. Please try again.";
    }
} else {
    echo "Invalid request.";
}
?>