PHP表单没有正确邮寄表单的详细信息

时间:2016-10-04 09:48:37

标签: php html email

所以我有一个带有jquery的HTML表单,我已经获取了输入并将它们分配给变量。由于某种原因,电子邮件不发送,我不知道为什么。我已经为$ to变量分配了一封电子邮件,并为邮件和标题添加了变量,以便更轻松。我错过了一些明显的东西吗?

这是PHP:

<?php


 $name=$_POST['name'];
 $tab=$_POST['tab'];
 $email=$_POST['email'];
 $bread=$_POST['bread'];
 $fav=$_POST['fav'];
 $ingred=$_POST['ingred'];
 $other=$_POST['other'];
 $spec=$_POST['spec'];

$to = '****MYEMAIL****@hotmail.co.uk';

$email_subject = "Shop Order from $name";
$email_body = "You have received a new message from your website    contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail:     $email\n\nTab:  $tab\n\nMessage:\n$bread,\n\n$fav,\n\n$ingred,\n\n$other,\n\n$spec";
$email_body = wordwrap($email_body, 70, "\r\n");
$headers = "From: zimilp@gmail.com\n"; 
$headers .= "Reply-To: $email";   
mail($to,$email_subject,$email_body,$headers);

header("Location: http://MYWEB.com/");

 ?>

和表单的html:

<section id="order">
            <center>
        <!-- multistep form -->
        <form name="sentOrder" id="msform" action="mail/orderform.php" method="post">
          <!-- progressbar -->
          <ul id="progressbar">
            <li class="active mycolour">Details</li>
            <li class="mycolour">Toastie</li>
            <li class="mycolour">Other</li>
          </ul>
            <style>
                .mycolour{

                    color: black !important;
                }
            </style>
          <!-- fieldsets -->
          <fieldset>
            <h2 class="fs-title">Your information</h2>
            <h3 class="fs-subtitle">Without this we can't accept your order</h3>
            <input type="text" name="name" placeholder="Your Name" required />
            <input type="text" name="tab" placeholder="Your Tab  Number" required />
            <input type="email" name="email" placeholder="Your Email" required/>
            <input type="button" name="next" class="next action-button" value="Next" id="v1" />
          </fieldset>
          <fieldset>

              <!-- Try and change this to a select thing and a text area need to create a select thing in the css for it too-->
            <h2 class="fs-title">Your toastie</h2>
            <h3 class="fs-subtitle">Customise it here</h3>
            <input type="text" name="bread" placeholder="Bread/Wrap/Panini" required/>
            <input type="text" name="fav" placeholder="Toastie Favourite" required />
            <textarea rows="6" id="one"  name="ingred" placeholder="Ingredients" required></textarea>
            <input type="button" name="previous" class="previous action-button" value="Previous" />
            <input type="button" name="next" class="next action-button" value="Next" id="v2" />
          </fieldset>
          <fieldset>
            <h2 class="fs-title">Anything Else</h2>
            <h3 class="fs-subtitle"></h3>
            <textarea rows="4" id="two" name="other" placeholder="What else do you want? e.g. Marylands and a pint of coke"  required></textarea>
              <textarea rows="4" id="three" name="spec" placeholder="Special requests e.g. Cut my toastie in half or don't microwave my popcorn" required ></textarea>


            <input type="button" name="previous" class="previous action-button" value="Previous" />
            <input type="submit" name="submit" class="submit action-button" value="Submit" id="v3"/>
          </fieldset>
        </form>
            </center>
        </section>

0 个答案:

没有答案