我试过看过这里发布的类似问题,但找不到答案(弹出大约1900个问题)。
我在网页托管网站上创建的网站页面上有一个联系表单 https://www.one.com/en/
以下是页面contact / contact.shtml
上的表单<form action="contact/mail.php" method="post"><br>
Your name<br>
<input type="text" name="cf_name"><br>
Your e-mail<br>
<input type="text" name="cf_email"><br>
Message<br>
<textarea name="cf_message"></textarea><br>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>
以下是contact / mail.php文件的内容
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = 'clashton@gmail.com';
$subject = ' Contact Form '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contact.shtml';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to clashton@gmail.com');
window.location = 'contact.shtml';
</script>
<?php
}
?>
当我尝试发送消息时,弹出一个窗口,其中包含错误消息&#34;消息失败。请发送电子邮件至clashton@gmail.com"。换句话说,&#34; else&#34;行动正在发生。
如果这个问题似乎有一个简单的答案,请记住,我对此完全陌生。
感谢您的帮助。