-1

I have this contact form and the PHP for it but it wont send the emails at all, can i get a second set of eyes on this please? the first code sample below is from the index.html and PHP is from contact.php

Contact form:

<form action="contact.php" method="POST">
    <p>Name</p> <input type="text" name="name" class="form-control">
    <p>Email</p> <input type="text" name="email" class="form-control">
    <p>Phone</p> <input type="text" name="phone" class="form-control">

    <p>Request Phone Call:</p>
    Yes:<input type="checkbox" value="Yes" name="call" class="form-control">
    No:<input type="checkbox" value="No" name="call" class="form-control">
    <p>Priority</p>
    <select name="priority" size="1" class="form-control">
        <option value="Low" class="form-control">Low</option>
        <option value="Normal" class="form-control">Normal</option>
        <option value="High" class="form-control">High</option>
        <option value="Emergency" class="form-control">Emergency</option>
    </select>

    <p>Message</p><textarea name="message" rows="6" cols="25" class="form-control"></textarea><br />
    <input type="submit" value="Send"class="form-control"><input type="reset" value="Clear" class="form-control">

Contact.php-

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$call = $_POST['call'];
$website = $_POST['website'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Priority: $priority \n Message: $message";
$recipient = "test@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
Manoj Sharma
  • 1,467
  • 2
  • 13
  • 20
Ketih Carpenter
  • 85
  • 2
  • 3
  • 9

1 Answers1

0

mail(to,subject,message,headers,parameters);

But in case of your code to email id is fixed : test@gmail.com change $recipient with $email.

erdeepak
  • 385
  • 1
  • 5
  • 14