提交表单按钮PHP电子邮件代码时,我没有获得输出,这并没有给我结果



我试图使用html&PHP,当我使用input type="submit" name="submit" value="Submit"

测试代码时,它运行良好

但是使用div&按钮类:"它对我不起作用。

有人可以帮我吗?

我的php代码

<? php 
       if(isset($_POST['submit']))
{
        $to = "example@gmail.com";
        $from = $_POST['email'];
      $name = $_POST['name'];
      $email = $_POST['email'];
      $phone =$_POST['phone'];  
      $subject = "Enquiry From".$name;
      $subject2 = "Copy of your Enquiry";
      $message = $name . " " . "wrote the following:" . "nn" . $_POST['message'] ."Contact Details:" . "nn" .$_POST['email'] . $_POST['phone'];
    $message2 = "Here is a copy of your message " . $name . "nn" . $_POST['message'];
    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); 
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
}
?>

===========================

html表单代码

<div class="container-contact100">
    <div class="wrap-contact100">
        <form class="contact100-form validate-form" action="mail.php" method="post">
            <span class="contact100-form-title">
                Feel free to reach us
            </span>
            <div class="wrap-input100 validate-input" data-validate="Please enter your name">
                <input class="input100" type="text" name="name" placeholder="Full Name">
                <span class="focus-input100"></span>
            </div>
            <div class="wrap-input100 validate-input" data-validate = "Please enter your email: e@a.x">
                <input class="input100" type="text" name="email" placeholder="E-mail">
                <span class="focus-input100"></span>
            </div>
            <div class="wrap-input100 validate-input" data-validate = "Please enter your phone">
                <input class="input100" type="number" name="phone" placeholder="Phone">
                <span class="focus-input100"></span>
            </div>
            <div class="wrap-input100 validate-input" data-validate = "Please enter your Subject">
                <input class="input100" type="text" name="subject" placeholder="Subject">
                <span class="focus-input100"></span>
            </div>
            <div class="wrap-input100 validate-input" data-validate = "Please enter your message">
                <textarea class="input100" name="message" placeholder="Your Message"></textarea>
                <span class="focus-input100"></span>
            </div>
            <div class="container-contact100-form-btn">
                <button type="submit" class="contact100-form-btn" type="submit">
                    <span>
                        <i class="fa fa-paper-plane-o m-r-6" aria-hidden="true"></i>
                        Send
                    </span>
                </button>
            </div>
        </form>
    </div>
</div>
<div id="dropDownSelect1"></div>

使用

如果(isset($ _ post ['email']((

为什么?您没有任何名称提交的元素。您重复类型="提交"两次

相关内容

  • 没有找到相关文章

最新更新