-1
<?php 
// code goes here
$to = ""; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$one = $_POST['one'];
$two = $_POST['two'];
$three = $_POST['three'];
$four = $_POST['four'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $name . " " . $one . " " . $two . " " . $three . " " . $four . " " . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];

$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Thankyou for your feedback " . $name;

?>

EMAIL:                             Name(optional):           

I am very satisfied with the way the company is performing its tasks to its clients.

Strongly agree Agree Neutral Disagree Strongly disagree

How satisfied are you with the company services?

Not at all SatisfiedSomehow Satisfied Satisfied Very Satisfied Delighted

How often do you use our services?

Once a yearDaily Weekly Monthly Every 2 to 3 months Do not use

p>Based on your awareness of our Service, is it better, the same, or worse than other companies?

Much betterBetter About the same Worse Much Worse

1 Answers1

0

Let's try to send it using this function:

back.php

Here is some input data:

$to      = $_POST['to'];
$subject = $_POST['subj'];
$message = $_POST['message'];
$from    = 'robot@' . $_SERVER['HTTP_HOST'];

Here is the function:

function send_mail($to, $from, $subject, $message) {
  $headers = ['From: ' . $from, 'Reply-To: ' . $from, 'X-Mailer: PHP/' . phpversion()]
  return mail($to, $subject, $message, implode("\r\n", $headers));
}

Here is how it can be used:

send_mail($to, $from, $subject, $message);

index.html Here is the form:

<form action="back.php" method="post">
    <input type="text" placeholder="To" name="to">
    <input type="text" placeholder="Subject" name="subj">
    <textarea name="message"></textarea>
    <input type="submit" value="Send">
</form>
  • If it's didn't helps, can you please provide var_dump of each of your variables. Second: check you target email. Third: check "Spam" at your inbox. – Максим Владимирович Feb 22 '17 at 09:08
  • would you please do me a code that submits data of a form, because av done som much and still no results, you can use the php above to guide you on the varialbes @Максим Владимирович – Shadrack Emachar Feb 22 '17 at 09:49