This is my HTML form, which is inside a little box on my site.
You have not mention where you have kept your php code file? Is it contact folder? and also look after the file location of Mail.php. This file must be under contact folder.
In the code you posted, you attempted to set the value of $body
on line 13, but did not set the value of $name
until line 22. $name
is null at the time you assign it to $body
, so $body
does not contain the values you are hoping for.
To fix this problem, move the $body = ...
line below the other assignments. Something like this:
...
// Get form var's
$name = "Test"; // I set $name to "Test" in the PHP and still the variable does not appear in the email.
$destin = $_POST['destin'];
$email = $_POST['Email'];
$pfrom = $_POST['pfrom'];
// Populate $body
$body = $name . " wants to go to " . $destin . " from " . $pfrom;
...