0

So I have a HTML form with jquery and I've taken the inputs and assigned them to variables. For some reason, the email just doesn't send and I am not sure why. I've assigned an email to the $to variable and have variables for the message and headers too to make it easier. Am I missing something blatantly obvious?

Here's the 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/");

 ?>

and the html for the form:

<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>
devpro
  • 16,184
  • 3
  • 27
  • 38
  • mail configuration issue? – devpro Oct 04 '16 at 09:52
  • It is very likely that the e-mail ends up in the spam folder if you don't make sure all the headers are set up the right way. – Henrik Oct 04 '16 at 09:53
  • I have checked my junk folder, it's not in there - and what do you mean by mail configuration issues? I'm new to this, so not too familiar with everything – Jaisal Patel Oct 04 '16 at 10:00
  • Possible duplicate of [PHP mail form doesn't complete sending e-mail](http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) – devpro Oct 04 '16 at 10:02

0 Answers0