-1

I have a problem with php mail generator. I don`t understand my code put $visitor_email in message... Can you help me?

id = $_POST['ID'];
$tt = $_POST['TT'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];

//Validate first
if(empty($id)||empty($tt)||empty($visitor_email)) 
{
    echo "ID, TT and email are required!";
    exit;
}

if(IsInjected($visitor_email))
{
    echo "Wrong email!";
    exit;
}

$email_from = 'xxx@mymail.com';//<== update the email address
$email_subject = "Something in title";
$email_body = "$message".

$to = "$visitor_email";//<== update the email address
$headers = "From: $email_from \r\n";
//Send the email!
mail($to, $email_subject, $email_body, $headers);
//done. redirect to thank-you page.
header('Location: end-page.html');
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
user9557556
  • 43
  • 1
  • 5

1 Answers1

0

Replace . after the $message with ; . will concatenate the variables.

$email_body = $message;
Yogs
  • 78
  • 7