我无法获取此代码不显示感谢您不完整提交的模块。我也希望页面重定向到始发页面(用弹出模块确认或模块页面上的错误将是最佳的),或者只是重定向到始发页面,而不必为每个页面创建一个新的PHP文件联系表单已打开。我有一些。Bootstrap联系表单模块问题
现在它可以发送邮件,但只需键入一个空白页面,并使用浏览器后退按钮返回原始页面。即使输入正确,它也会激发(谢谢)模块。是否有可能得到这方面的帮助?
<form class="o-form" id="contactForm" action="php/contact.php" method="post">
<input type="email" name="senderEmail" id="senderEmail" required="required" placeholder="email">
<textarea name="message" id="message" required="required placeholder="message"></textarea>
<input type="submit" value="send" class="send-button">
</form>
</div>
</div>
</div>
</div>
<div class="copyright">
<span>
anthonygallina
</span>
</div>
</footer>
<div class="th-popup">
<div class="massage-th">
<h1>Thank You!</h1>
<p>We apreciate your visit to our home page. We will contact you soon!</p>
</div>
</div>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/all.js"></script>
<script src="js/jquery.mixitup.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/idangerous.swiper.min.js"></script>
</body>
</html>
<?php
,另一部分
// Define some constants
define("RECIPIENT_NAME", "YOURNAME");
define("RECIPIENT_EMAIL", "[email protected]");
define("EMAIL_SUBJECT", "Visitor Message");
// Read the form values
$success = false;
$senderEmail = isset($_POST['senderEmail']) ? preg_replace("/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail']) : "";
$message = isset($_POST['message']) ? preg_replace("/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message']) : "";
// If all values exist, send the email
if ($senderEmail && $message) {
$recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
$headers = "From: " . $senderEmail . " <" . $senderEmail . ">";
$success = mail($recipient, EMAIL_SUBJECT, $message, $headers);
}
// Return an appropriate response to the browser
if (isset($_GET["ajax"])) {
echo $success ? "success" : "error";
} else {
?>
<html>
<head>
<title>Thanks!</title>
</head>
<body>
<?php if ($success) echo "<p>Thanks for sending your message! We'll get back to you soon.</p>" ?>
<?php if (!$success) echo "<p>There was a problem sending your message. Please try again.</p>" ?>
<p>Click your browser's Back button to return to the page.</p>
</body>
</html>
<?php
}
?>
读第二段 –
我不知道什么是不工作时,当我调试它,当我读它时,它是好的。这就是我在这里发布的原因。 –
'if(isset($ _ GET [“ajax”])){ echo $ success? “成功”:“错误”; '不清楚。 –