Contact Form is not sending ‘$message’, ‘$email’, or ‘$name’, just ‘$from’ info arrives
Here’s the code:
[CODE]<?php
$data = json_decode(file_get_contents(“php://input”));
$name = trim($data->name);
$name = str_replace(array(“r”, “n”), array(” “, ” “), $name);
$email = filter_var(trim($data->email), FILTER_SANITIZE_EMAIL);
$message = trim($data->message);
if (empty($name) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo “One or more invalid entries. Please try again.”;
exit;
}
$to = “support@….com”;
$from = “From: contact-form@….com”. “rn”;
$email = $_POST[’email’];
$name = $_POST[‘name’];
$message = $_POST[‘message’];
if (mail($to, $message, $from, $email, $name )){
echo “Thank You. Your message has been sent.”;
} else {
echo “An error has occurred and your message could not be sent.”;
}
?>[/CODE]