当用户输入他们的联系方式并按下提交按钮时,我的联系表单不会发送电子邮件。我究竟做错了什么?
HTML:
<div class="row">
<form action="mail.php" accept-charset="utf-8" method="post">
<div class="form-group contacts-form-result">
<div class="col-xs-12">
<strong></strong>
</div>
</div>
<div class="form-group clearfix">
<div class="col-xs-12 col-md-6">
<input type="text" placeholder="Your name *" name="name" class="form-control" required>
</div>
</div>
<div class="form-group clearfix">
<div class="col-xs-12 col-md-6">
<input type="email" placeholder="Your e-mail address *" name="email" class="form-control" required>
</div>
</div>
<div class="form-group clearfix">
<div class="col-xs-12">
<textarea placeholder="Your message *" rows="7" name="message" class="form-control" required></textarea>
</div>
</div>
<div class="form-group clearfix">
<div class="col-xs-12">
<button type="submit" class="btn btn-2">Send Enquiry</button>
</div>
</div>
</form>
PHP:
<?php
if (isset($_POST['submit'])){
$subject = $_POST['subject'];
$name = $_POST['name'];
$mailFrom = $_POST['email'];
$message = $_POST['message'];
$mailTo = "myemail@email.com";
$headers = "Enquiry from: ".$mailFrom;
$txt = "Name: ".$name."\n"."Message: ".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: success.html?mailsent");
}?>
我该如何解决这个问题,以便在按下按钮时发送电子邮件?谢谢你。
慕的地6264312