我之前有一个电子邮件表单,我相信这段代码。 但突然之间,它不会再拍出电子邮件了。
这是我的代码。
HTML
<form action="index.php" method="post">
<div class="grid_6">
<input type="text" name="name" value="" placeholder="Name">
<input type="text" name="subject" value="" placeholder="Phone">
<input type="text" name="email" value="" placeholder="Email">
</div>
<div class="grid_6 omega"><textarea name="message" id="message" placeholder="Message"></textarea></div>
<div class="clear"></div>
<span style="float:left; margin-left:18px;">
<input type="reset" class="contact_btn" value="Clear Form">
<input type="submit" class="contact_btn send_btn" value="Send">
</span>
</center>
</form>
和PHP
<?
if (isset($_POST['submit'])){
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$msg = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$to = "hello@darrylhuffman.com";
$subject = 'Portfolio message from' .$name;
$message = $msg;
$from = $email;
$headers = "From:" . $email;
mail($to,$subject,$message,$headers);
echo "Thank you for your message";
}
?>
可能这是一个初学者的错误,但我很难过。提前致谢! :)
答案 0 :(得分:4)
您正在检查&#34;提交&#34;未定义的字段,将名称添加到输入
<input type="submit" class="contact_btn send_btn" value="Send" name="submit">