<div class="row">
<div class="col-12">
<form id="form" method="POST" class="contact-form" enctype="multipart/form-data">
<div class="row">
<div class="form-group col-md-6 col-lg-6 col-xl-6">
<input id="name" type="text" id="contact_name" name="name" class="form-control" placeholder="Ваше имя" required/>
</div>
<div class="form-group col-md-6 col-lg-6 col-xl-6 tm-col-email">
<input id="email" type="email" id="contact_email" name="email" class="form-control" placeholder="E-mail" required/>
</div>
</div>
<div class="form-group">
<textarea id="msg" id="contact_message" name="message" class="form-control" rows="9" placeholder="Сообщение" required></textarea>
</div>
<button type="submit" class="btn btn-primary tm-btn-submit" onclick="ok()">Отправить</button>
<script>
function ok() {
return swal(
'Благодоарим',
'Мы с вами свяжемся!',
'Успешно'
)
}
</script>
</form>
</div>
</div>
$(document).ready(function (
$("#form").submit(
function (event) {
e.preventDefault();
event.preventDefault();
$.ajax((
url: "mail.php",
type: "post",
data: $("#form").serialize();
)
}
);
){
})
<?php
$header = "From: " . $name . " <" . trim($_POST['contact_email']) . ">" . PHP_EOL;
$EOL = "\r\n";
$subject= '=?utf-8?B?' . base64_encode($subject_text) . '?=';
$theme = "Заказ";
$letter ="Данные сообщения: Имя:".$_POST["name"];
$letter .=" Почта:".$_POST["email"];
$letter .=" Сообщение:".$_POST["message"];
mail('hydrapc@yandex.ru', $theme , $letter);
echo '<script language="javascript">';
echo 'alert("Successful!")';
?>