Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.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
Javascript PHP联系方式赢得';我不能适当地提交_Javascript_Php_Html_Forms - Fatal编程技术网

Javascript PHP联系方式赢得';我不能适当地提交

Javascript PHP联系方式赢得';我不能适当地提交,javascript,php,html,forms,Javascript,Php,Html,Forms,我在我的网站上得到了我的简单PHP联系人表单 但当我将我的联系人表单迁移到时,它给了我一个错误“出了问题:(” 我在下面发布了我的代码,希望您能看到,任何帮助都会很好——因为我不是PHP的高手 HTML <section id="contact"> <div class="container"> <div class="row"> <div class="col-lg-12 mx-auto"> <div cla

我在我的网站上得到了我的简单PHP联系人表单

但当我将我的联系人表单迁移到时,它给了我一个错误“出了问题:(”

我在下面发布了我的代码,希望您能看到,任何帮助都会很好——因为我不是PHP的高手

HTML

<section id="contact">
<div class="container">
  <div class="row">
     <div class="col-lg-12 mx-auto">
        <div class="row">
           <div class="col-sm-12 col-sm-offset-3">
              <div class="well">
                 <h1>Contact Us</h1>
                 <p class="text-center">We are always interested in hearing about how we can improve your visit. If you need more information regarding our packages, or if you wish to set up a detailing appointment, toss us a message below and we will get back to you ASAP.</p>
                 <hr>
                 <form role="form" id="contactForm" data-toggle="validator" class="shake">
                    <div class="row">
                       <div class="form-group col-sm-6">
                          <label for="fname" class="h4">First Name</label>
                          <input type="text" class="form-control" id="fname" placeholder="Please enter your First Name" required data-error="Please Enter First Name">
                          <div class="help-block with-errors"></div>
                       </div>
                       <div class="form-group col-sm-6">
                          <label for="lname" class="h4">Last Name</label>
                          <input type="text" class="form-control" id="lname" placeholder="Please enter your Last Name" required data-error="Please Enter Last Name">
                          <div class="help-block with-errors"></div>
                       </div>
                    </div>
                    <div class="row">
                       <div class="form-group col-sm-6">
                          <label for="email" class="h4">Email</label>
                          <input type="text" class="form-control" id="email" placeholder="Whats your e-mail?" required data-error="Please enter email">
                          <div class="help-block with-errors"></div>
                       </div>
                       <div class="form-group col-sm-6">
                          <label for="phone" class="p">Phone</label>
                          <input type="text" class="form-control" id="phone" placeholder="Whats your phone number?" required data-error="Please enter Phone Number">
                          <div class="help-block with-errors"></div>
                       </div>
                    </div>
                    <div class="row">
                       <div class="form-group col-sm-12">
                          <label for="email" class="h4">Service</label>
                          <select class="form-control" id="service" placeholder="Service"name="services">
                             <option value="" selected disabled>Please choose a service</option>
                             <option value="Gold Package ($79.99 / $99.99)">Gold Package ($79.99 / $99.99)</option>
                             <option value="Platinum 1 Package ($144.99 / $174.99)">Platinum 1 Package ($144.99 / $174.99)</option>
                             <option value="Platinum 2 Package ($199.99 / $229.99)">Platinum 2 Package ($199.99 / $229.99) </option>
                             <option value="VIP Package ($329.99 / $359.99)">VIP Package ($329.99 / $359.99)</option>
                             <option value="Express Package ($29.99 / $39.99)">Express Package ($29.99 / $39.99)</option>
                             <option value="Interior Package ($119.99 / $139.99)">Interior Package ($119.99 / $139.99)</option>
                             <option value="Exterior Package ($84.99 / $134.99)">Exterior Package ($84.99 / $134.99)</option>
                             <option value="Additional Services">Additional Services</option>
                          </select>
                          <div class="help-block with-errors"></div>
                       </div>
                    </div>
                    <div class="form-group">
                       <label for="message" class="p ">Message</label>
                       <textarea id="message" class="form-control" rows="5" placeholder="Please leave details here about the make and model of your car, and any additional information we can use to make your apppointment or request better! Thank you" required></textarea>
                       <div class="help-block with-errors"></div>
                    </div>
                    <button style="width:100%; padding: 10px; margin-bottom: 20px;" type="submit" id="form-submit" class="btn btn-success btn-lg pull-right ">Submit</button>
                    <p class="text-center" style="font-size: 14px;">Please do your best to fill out the form below with as much information as possible so we can get started right away on your inquiry!</p>
                    <p class="text-center" style="font-size:14px;">Thank you from all of us here at Speedvale Auto Detailing.</p>
                    <div id="msgSubmit" class="h3 text-center hidden"></div>
                    <div class="clearfix"></div>
                 </form>
              </div>
           </div>
        </div>
     </div>
  </div>
</div>
</section>
任何人谁可以帮助这将是伟大的,这是我需要完成的网站的最后一块

非常感谢!

因为输出是“出了问题:”(“所以根据您的代码,即

$success = mail($EmailTo, $Subject, $Body, "From:".$email);

// redirect to success page
if ($success && $errorMSG == ""){
   echo "success";
}else{
    if($errorMSG == ""){
        echo "Something went wrong :(";
    } else {
        echo $errorMSG;
    }
}
邮件未发送,您在发送邮件时在$success中出现错误。另外,还可以改善else条件:

if(!empty($errorMSG)){
     echo "Something went wrong, error: " . $errorMSG;
} else {
     echo "Mail not sent";
}

您是否看到导致错误的任何地方,我不理解,因为我直接复制了代码。=/感谢您的回复。这来自代码中的“成功”消息,您要求$success为true和$errorMSG==”(这是真的,因此您得到的是“出了问题:(”)。
$success = mail($EmailTo, $Subject, $Body, "From:".$email);

// redirect to success page
if ($success && $errorMSG == ""){
   echo "success";
}else{
    if($errorMSG == ""){
        echo "Something went wrong :(";
    } else {
        echo $errorMSG;
    }
}
if(!empty($errorMSG)){
     echo "Something went wrong, error: " . $errorMSG;
} else {
     echo "Mail not sent";
}