我试图让一个简单的网络形式工作,但我几乎不知道psp,所以忍受我。这是php文件
<?php
if(!isset($_POST['submit'])) {
$emailbody = 'name: '.$_POST['name']."\n"
.'email: '.$_POST['email']."\n"
.'message: '.$_POST['message']."\n";
mail('myemail@email.com', 'Subject line', $emailbody);
header('location: thankyou.html');
} else {
header('location: contact.html');
}
?>
这是形式html:
<form method="post" action="test.php">
<!-- ===START FIELDS=== -->
<div class="fieldset">
<h2 class="contact-form">Contact Us</h2>
<div class="fields">
<p class="row">
<label>Name:</label>
<input type="text" id="first-name" name="name" class="field-large" required="required" aria-required="true" /></p>
<p class="row"><label>Email<span class="required">*</span>:</label><input type="email" id="email" name="email" placeholder="yourname@example.com" class="field-large" /></p>
<p class="row"><label>Message:</label><textarea id="message" id="message" name="message" cols="40" rows="5" class="field-large"/></textarea></p>
<input type="submit" value="submit" name="send" class="btn" />
</div>
</div>
</form>
点击“提交”后,我会被重定向到“谢谢你”。页面,但我没有收到任何电子邮件。我在XAMPP上进行测试,以防万一。我已经检查了类似的问题,建议添加!在确定之前,但这并没有帮助。