Files
olimparena/send-form.php

32 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = strip_tags(trim($_POST["name"]));
$phone = strip_tags(trim($_POST["phone"]));
$email = strip_tags(trim($_POST["email"]));
//$to = "receptionadmin@o-arena.ru"; // поменяй на свой реальный email
$to = "rid89@mail.ru"; // поменяй на свой реальный email
$subject = "Новая заявка с сайта OlimpArena";
$message = "Имя: $name\n";
$message .= "Телефон: $phone\n";
$message .= "Email: $email\n";
$message .= "Дата отправки: " . date('d.m.Y H:i') . "\n";
$headers = "From: no-reply@o-arena.ru\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "Content-Type: text/plain; charset=utf-8\r\n";
if (mail($to, $subject, $message, $headers)) {
// Можно перенаправить на успех
header("Location: index.html#booking-success-modal");
// или показать JSON для JS
echo json_encode(["status" => "success"]);
} else {
echo json_encode(["status" => "error"]);
}
} else {
http_response_code(403);
echo "Доступ запрещён";
}
?>