Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPMailer赢得';不要发送消息_Php_Forms_Phpmailer - Fatal编程技术网

PHPMailer赢得';不要发送消息

PHPMailer赢得';不要发送消息,php,forms,phpmailer,Php,Forms,Phpmailer,我在这一页上有两张表格。第一个有效。第二个没有 建议的答案没有任何解决我问题的答案。他们建议检查错误消息(我已经报告了问题底部收到的错误消息)。此外,这个问题的答案甚至没有一个被认为解决了这个问题。这似乎是我的代码中的一个问题,因为其中一个表单在同一页上运行良好。所以,这张表格一定有问题 联系页面PHP: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> &

我在这一页上有两张表格。第一个有效。第二个没有

建议的答案没有任何解决我问题的答案。他们建议检查错误消息(我已经报告了问题底部收到的错误消息)。此外,这个问题的答案甚至没有一个被认为解决了这个问题。这似乎是我的代码中的一个问题,因为其中一个表单在同一页上运行良好。所以,这张表格一定有问题

联系页面PHP:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="apple-touch-icon" href="_images/icon_180.png">
    <link rel="apple-touch-icon" sizes="76x76" href="_images/icon_76.png">
    <link rel="apple-touch-icon" sizes="120x120" href="_images/icon_120.png">
    <link rel="apple-touch-icon" sizes="152x152" href="_images/icon_152.png">
    <link rel="apple-touch-icon" sizes="167x167" href="_images/icon_167.png">
    <link rel="apple-touch-icon" sizes="180x180" href="_images/icon_180.png">
    <title>Southeast Jeet Kune Do | Augusta, GA | Contact</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css">
    <link rel="stylesheet" href="_css/styles.css?v=1.0.3">
    <!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-63178620-3', 'auto');
ga('send', 'pageview');
</script>
<script async src='//www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics --></head>
<script>
    function validateForm() {
        var x = document.forms["myForm"]["name"].value;
        var y = document.forms["myForm"]["address"].value;
        var z = document.forms["myForm"]["message"].value;
        if (x == null || x == "" || y == null || y == "" || z == null || z == "") {
            alert("Please fill out all required fields before you submit your message.");
            return false;
        }
    }
    function validateForm2() {
        var x = document.forms["myForm2"]["name"].value;
        var y = document.forms["myForm2"]["address"].value;
        var z = document.forms["myForm2"]["message"].value;
        if (x == null || x == "" || y == null || y == "" || z == null || z == "") {
            alert("Please fill out all required fields before you submit your message.");
            return false;
        }
    }
</script><body>
    <header>
    <div class="container">
        <a href="index.php"><img src="_images/logo_small_text.png" alt="Southeast Jeet Kune Do Logo"></a>
        <i class="zmdi zmdi-menu"></i>
    </div>
</header>  
    <figure class="overlay"></figure>
<nav>
    <img src="_images/logo_nav.png" alt="">
    <ul>
        <li>
            <a href="index.php">Home</a>
        </li>
        <li>
            <a href="about.php">About</a>
        </li>
        <li>
            <a href="styles.php">Styles</a>
        </li>
        <li class="category">
            Classes
            <ul>
                <li><a href="classes_adults.php">Adults</a></li>
                <li><a href="classes_kids.php">Kids</a></li>
                <li><a href="classes_seminars.php">Seminars</a></li>
            </ul>
        </li>
        <li>
            <a href="schedule.php">Schedule</a>
        </li>
        <li>
            <a href="pricing.php">Pricing</a>
        </li>
        <li>
            <a href="faq.php">FAQ</a>
        </li>
        <li>
            <a href="contact.php">Contact</a>
        </li>
    </ul>
</nav>  
    <main class="contact">
        <h1>Contact</h1>
        <section>
            <div class="container">
                <form name="myForm" id="myForm" method="post" action="mail.php" onsubmit="return validateForm()" class="contact-form">
                    <h2>Have Questions?</h2>
                    <p>Send us an email. We will contact you shortly!</p>
                    <input type="text" placeholder="Name (required)" name="name">
                    <input type="hidden" name="email">
                    <input type="email" placeholder="Email Address (required)" name="address">
                    <input type="tel" placeholder="Phone Number" name="phone">
                    <textarea name="message" id="" cols="30" rows="3" placeholder="Comments (required)"></textarea>
                    <input type="submit">
                </form>
                <span class="desktop">
                    <h2>Phone Number</h2>
                    <p>706.364.8127</p>
                    <h2>Address</h2>
                    <p>4158 Washington Rd<br>Evans, GA 30809</p>
                </span>
                <span class="mobile">
                    <a href="tel:706.364.8127"><button>Call Us</button></a>
            <a href="http://maps.apple.com/?daddr=4158+Washington+Rd+Evans,+GA+30809&dirflg=d&t=m"><button>Get Directions</button></a>
                </span>
            </div>
        </section>
    </main>
    <script>
    $('.zmdi-menu, figure.overlay').click(function(){
        $('nav').toggleClass('show');
        $('figure.overlay').fadeToggle(500);
    })
    $('.category').click(function(){
        $(this).toggleClass('active');
        $('ul', this).slideToggle(); 
    });
    $('#reveal_button').click(function(){
        $(this).fadeOut(500);
        $('.form_hidden').delay(500).slideDown(500);
    });
</script>

<footer>
    <div class="container cf">
        <div class="four">
            <ul>
                <li>Menu</li>
                <li><a href="index.php">Home</a></li>
                <li><a href="about.php">About</a></li>
                <li><a href="styles.php">Styles</a></li>
                <li><a href="classes_adults.php">Classes</a></li>
                <li><a href="schedule.php">Schedule</a></li>
                <li><a href="pricing.php">Pricing</a></li>
                <li><a href="faq.php">FAQ</a></li>
                <li><a href="contact.php">Contact</a></li>
            </ul>
        </div>
        <div class="four">
            <ul>
                <li>Social</li>
                <li><a href="https://www.facebook.com/SoutheastJKD/" target="_blank">Facebook</a></li>
                <li><a href="https://twitter.com/southeastjkd" target="_blank">Twitter</a></li>
                <li><a href="https://www.instagram.com/southeastjeetkunedo/" target="_blank">Instagram</a></li>
            </ul>
        </div>
        <div class="four">
            <ul>
                <li>Contact Info</li>
                <li>706.364.8127</li>
                <li>4158 Washington Rd<br>
        Evans, GA 30809</li>
            </ul>
        </div>
        <div class="four">
            <h2>Have Questions?</h2>
            <p>Send us an email. We will contact you shortly!</p>

                <form name="myForm2" id="myForm2" method="post" action="mail.php" onsubmit="return validateForm2()" class="contact-form footer">
                    <input type="text" placeholder="Name (required)" name="name">
                    <input type="hidden" name="email">
                    <input type="email" placeholder="Email Address (required)" name="address">
                    <input type="tel" placeholder="Phone Number" name="phone">
                    <textarea name="message" id="" cols="30" rows="3" placeholder="Comments (required)"></textarea>
                    <input type="submit">
                </form>
        </div>
    </div>
</footer></body>
</html>

佐治亚州奥古斯塔截拳道东南部联系人
window.ga=window.ga | |函数(){(ga.q=ga.q | |[]).push(参数)};ga.l=+新日期;
ga(“创建”、“UA-63178620-3”、“自动”);
ga(‘发送’、‘页面浏览’);
函数validateForm(){
var x=document.forms[“myForm”][“name”].value;
var y=document.forms[“myForm”][“address”]。值;
var z=document.forms[“myForm”][“message”].value;
如果(x==null | | x==“”| | y==null | | y==“”| | z==null | | z==“”){
提醒(“请在提交邮件之前填写所有必填字段。”);
返回false;
}
}
函数validateForm2(){
var x=document.forms[“myForm2”][“name”].value;
var y=document.forms[“myForm2”][“address”]。值;
var z=document.forms[“myForm2”][“message”].value;
如果(x==null | | x==“”| | y==null | | y==“”| | z==null | | z==“”){
提醒(“请在提交邮件之前填写所有必填字段。”);
返回false;
}
}
  • 班级
接触 有问题吗? 给我们发电子邮件。我们将很快与您联系

电话号码 706.364.8127

地址 佐治亚州埃文斯市华盛顿路4158号,邮编30809

$('.zmdi菜单,figure.overlay')。单击(函数(){ $('nav').toggleClass('show'); $('figure.overlay').fadeToggle(500); }) $('.category')。单击(函数(){ $(this.toggleClass('active'); $('ul',this.slideToggle(); }); $(“#显示按钮”)。单击(函数(){ 美元(本)。淡出(500); $('.form_hidden')。延迟(500)。向下滑动(500); });
  • 菜单
  • 社会的
  • 联系信息
  • 706.364.8127
  • 华盛顿路4158号
    埃文斯,佐治亚州30809
有问题吗? 给我们发电子邮件。我们将很快与您联系

mail.php:

<?php

if ( $_POST['email'] != '' ) {

    die("You are a bot!"); 

} else {

    $name = $_POST['name'];
    $email = $_POST['address'];
    $phone = $_POST['phone'];
    $comments = $_POST['message'];

    require_once 'PHPMailer/PHPMailerAutoload.php';

    $mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch

    try {
      $mail->AddAddress('bboysupaman@gmail.com');
      $mail->AddCC("jesse@happyninja.io");
      $mail->SetFrom($email, $name);
      $mail->Subject = 'Southeast JKD Contact Form';
      $mail->MsgHTML("Name: $name<br><br>Email: $email<br><br>Phone: $phone<br><br>Comments: $comments");
      $mail->Send();
      header("Location: http://southeastjkd.com/success.php");
    } catch (phpmailerException $e) {
      header("Location: http://southeastjkd.com/failure.php");
    } catch (Exception $e) {
      header("Location: http://southeastjkd.com/failure.php");
    }

}

?>

我花了很多很多时间在谷歌上搜索和浏览我的代码。也许我忽略了一些简单的事情。。。但是,我不明白为什么第二个表单(myForm2)不起作用!有什么想法吗


捕获到的错误只是:“无法实例化邮件功能。”

我现在将检查可能的重复项,并让您确定。我检查了该项。我不认为问题在于没有安装send mail,因为第一个表单(myForm)可以工作。如果是这样的话,两种形式都不起作用,对吗?我不知道答案,只是看起来是同一个问题。可能不是。检查PHP错误日志,您可能会找到有关问题原因的更多信息。我现在将检查可能的重复项,并让您确定。我检查了该项。我不认为问题在于没有安装send mail,因为第一个表单(myForm)可以工作。如果是这样的话,两种形式都不起作用,对吗?我不知道答案,只是看起来是同一个问题。也许不是。查看PHP错误日志,您可能会找到有关问题原因的更多信息。