0

I cannot see what is wrong with this code. When I receive the email everything comes through ok except for the email address. In my email the email shows as a . no matter what I type or change it too.

Can anyone see why this is happening.

<form class="contact-page col-md-5 col-11" method="post" action="../php/contact-page-handler.php">
  <input type="text" name="name" placeholder="full name" required>
  <input type="text" name="mail" placeholder="your e-mail" required>
  <input type="text" name="subject" placeholder="subject" required>
  <textarea name="message" placeholder="enter your message here" rows="5" required></textarea>
  <button type="submit" name="submit">Send Message</button>
</form>

<?php
    $name = $_POST ['name'];
    $vistor_email = $_POST['email'];
    $email_subject = $_POST['email_subject'];
    $message = $_POST['message'];

    $email_from = 'enquires@emergencyplumbers247.com';

    $email_subject = "Customer Enquire";

    $email_body = "User Name: $name.\n".
                    "User Email: $vistor_email.\n".
                        "User Subject: $email_subject.\n".
                            "User Message: $message.\n";

    $to = "emergencyplumbers247uk@gmail.com";

    $headers = "From: $email_from \r\n";

    $headers .= "Reply-To:$vistor_email \r\n";

    mail($to,$email_subject,$email_body,$headers);

    header("Location: http://www.emergencyplumbers247.com/confirm.html");
?>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Bazla
  • 127
  • 2
  • 14
  • 1
    Your input is named mail, but in your php code, you say $_POST['email']. I would imagine your email subject doesn't work for the same reason. – purxiz Nov 17 '18 at 10:41
  • look like a good spot I'll check it later when I'm home thanks. – Bazla Nov 17 '18 at 11:05

1 Answers1

3

Your input field has name mail and not email. Correct it as:

$vistor_email = $_POST['mail'];

also check for subject

$email_subject = $_POST['subject'];
Twinkle
  • 191
  • 2
  • 12