问题描述
我在索引文件中包含了footer.PHP,并且页脚包含用于订阅者注册的FORM。 当我点击提交来自 https://mywebsite.com/index.php 的新订阅者电子邮件时,该值没有从 index.PHP 页面传递,当我使用 url https://mywebsite.com/footer.php
时,同样的代码完全适用footer.PHP
<form id="newsletterForm" action="newsletter-subscribe.PHP" method="POST">
<div class="input-group input-group-rounded">
<input name="mailid" type="email" placeholder="Email Address">
<span>
<input type="submit">
</span>
</div>
</form>
newsletter-subscribe.PHP
<?PHP
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = $_POST["mailid"];
$recipient = "info@myemail.com";
$email_content = "
<html>
<body>
<h2>Hello You had a new Subscriber!</h2>
<h3>Email Id : ".$email." </h3>
</body>
</html>
";
$email_headers = "MIME-Version: 1.0" . "\r\n";
$email_headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$email_headers .= 'From: info@myemail.com' . "\r\n";
if (mail($recipient,$subject,$email_content,$email_headers)) {
$msg= "Thanks You! For Subscribing our service.";
echo "<script type='text/JavaScript'>;window.location.href='../index.PHP';</script>";
} else {
$error= "Faild To Send Your Order. Please Try Again.";
echo "<script type='text/JavaScript'>alert ('$error');window.location.href='index.PHP';</script>";
}
} else {
$error1= "There was a problem with your submission,please try again.";
echo "<script type='text/JavaScript'>alert ('$error1');window.location.href='index.PHP';</script>";
}
?>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)