【发布时间】:2018-12-13 23:16:05
【问题描述】:
我对此有点陌生。一段时间以来,我一直在解决这个问题,将邮件从 HTML 表单发送到我的收件箱,并希望在我的收件箱中显示已填写的输入,并在收件箱中显示其他消息。
index.html
<form action="mail.php" method="post">
<section id="left">
<label for="form_name">Name</label>
<input name="form_name" id="form_name" type="text" >
<label for="form_email">Email</label>
<input name="form_email" id="form_email" type="email" >
<label for="form_msg">Message</label>
<textarea name="form_msg" id="form_msg"></textarea>
<input id="submit" class="button" name="submit" type="submit" value="send">
</section>
</form>
mail.php
<?php
if($_POST){
$name = $_POST['form_name'];
$email = $_POST['form_email'];
$message = $_POST['form_msg'];
$phone = $_POST['phone_no'];
//send email
mail("myemail@gmail.com", "This is a Reservation from:" ,Name. ':' . $name, $email, $phone);
}
?>
mail.js
$.ajax({
type: "POST",
url: "email.php",
data: $(form).serialize(),
success: function(){
$('.success').fadeIn(1000);
}
});
【问题讨论】: