sử dụng php kết hợp Sweetalert2 (ok)
form.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="http://localhost/library/sweetalert2/sweetalert2.min.css">
<script type="text/javascript" src="http://localhost/library/jquery/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/library/sweetalert2/sweetalert2.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<form role="form" id="contact-form" method="post">
<label for="name">Name</label>
<input type="text" placeholder="Full Name" name="name" required>
<label for="email">Email</label>
<input type="email" placeholder="Your Email" name="email" required>
<label>Message</label>
<textarea name="message" placeholder="Your Message" rows="9"></textarea>
<button type="submit" class="btn">Send</button>
</form>
</body>
</html>
<?php
$to = 'phamngoctuong1805@gmail.com' . "\r\n";
$subject = 'Subject';
$name = $_POST['name'];
$email = $_POST['email'];
$message = "************************************************** \r\n" .
"Message from you website! \r\n" .
"************************************************** \r\n" .
"Name: " . $name . "\r\n" .
"E-mail: " . $email . "\r\n" .
"Message: " . $_POST["message"] . "\r\n";
$headers = "From: " . $name . "<" . $email . "> \r\n" .
"Reply-To: " . $email . "\r\n" .
"MIME-Version: 1.0" . "\r\n" .
"Content-type:text/html;charset=UTF-8" . "\r\n";
mail($to, $subject, $message, $headers);
?>
PreviousAJAX request preConfirm (ok)NextMột ví dụ tuyệt vời Ajax SweetAlert for Live Data Deleting Rows in with PHP~MySQL~Ajax (ok)
Last updated