'Unable to Send HTML Form Entry using PHP

I am trying to send an html form entry to my email via PHP but the entries are empty. Here is my HTML code for the contact form:

<form action="assets/php/consultationmail.php" method="post">
<div class="input-field">
<input type="text" name="name" placeholder="Full Name" required>
</div>
<div class="input-field">
<input type="email" name="email" placeholder="[email protected]" required>
</div>
<div class="input-field">
<input type="tel" name="Phone" placeholder="0245678910" required>
</div>
<div class="input-field">
<input type="textarea" name="message" placeholder="Message" required>
</div>
<div class=" input-field">
<button type="submit" value="submit" class="template-btn">Get Consultations
<i class="far fa-long-arrow-right"></i></button>
</div>
</form>

and here's my PHP code

<?php

<?php
$subject = 'New Consultation Request'; // Subject of your email
$to = '[email protected]';  //Recipient's E-mail
$emailTo = $_REQUEST['email'];

$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$msg = $_REQUEST['message'];

$email_from = $name.'<'.$email.'>';

$headers = "MIME-Version: 1.1";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers .= "From: ".$name.'<'.$email.'>'."\r\n"; // Sender's E-mail
$headers .= "Return-Path:"."From:" . $email;

$message .= 'Name : ' . $name . "\n";
$message .= 'Email : ' . $email . "\n";
$message .= 'Phone : ' . $phone . "\n";
$message .= 'Message : ' . $msg;

if (@mail($to, $subject, $message, $email_from))
{
    // Transfer the value 'sent' to ajax function for showing success message.
    echo 'sent';
}
else
{
    // Transfer the value 'failed' to ajax function for showing error message.
    echo 'failed';
}

?>

This is the result I get in my mail:

<>

Name : Email : Phone : Message :

What am I doing wrong, please?



Solution 1:[1]

$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$message=$_POST['message'];
$email_from='[email protected]';
$email_subject='New Consultation Request';
$email_body='A visitor has request for a consultation.<br>Details are below<br>Name:'.$name.'<br>Email:'.$email.'<br>Phone:'.$phone.'<br>Message:'.$message.'<br>';
$to='[email protected]';    
$to=$to;
$subject=$email_subject;
$message=$email_body;
$headers='From:'.$email_from."\r\n".'Reply-To:'.$email."\r\n".'X-Mailer:PHP/'.phpversion();
mail($to,$subject,$message,$headers);

Solution 2:[2]

You forgot to close your $email_body statement with an ;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Lewin Muzvonda