请帮助这个 php 联系表。它有效,但是,我想将访问者重定向到不同的 .html 页面而不是显示感谢消息,但我不想丢失联系表单信息。谢谢 !
我正在使用非常简单的联系表格:
<form method="POST" action="sendmail.php" class="form">
<p class="yourName"> Submit Name:</p>
<input name="text" class="name" placeholder="Name" name="name">
<p class="yourEmail">Submit Email:</p>
<input type="text" class="email" placeholder="Email" name="email">
<p class="yourInquiry">Submit Inquiry:</p>
<input type="submit" value="Submit" class="Button">
</form>
<?php
$to = "xyz@hotmail.com";
$subject = "Inquiry from ". $_POST['name'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$html`enter code here` = "";
foreach ($_POST as $name => $value) {
$html .= "<strong>$name</strong><br>";
$html .= "<p>$value</p><br>";
}
if (mail($to, $subject, $html,$headers)) {
/* Success Message */
} else {
/* Error message */
}
header('Location:about.html');
} else {
echo "You didnt enter anything";
?>