PHP mail()函数发送空变量

For some reason name, email and message appear empty when I receive an email.

HTML

<form method="post" action="send.php" class="form-horizontal">
<fieldset>
    <!-- Text input-->
    <div class="form-group">
        <label class="col-md-4 control-label" for="name">Name</label>
        <div class="col-md-4">
            <input id="name" name="name" type="text" class="form-control input-md" required="">
        </div>
    </div>
    <!-- Text input-->
    <div class="form-group">
        <label class="col-md-4 control-label" for="email">Email</label>
        <div class="col-md-4">
            <input id="email" name="email" type="email" class="form-control input-md" required="">
        </div>
    </div>
    <!-- Textarea -->
    <div class="form-group">
        <label class="col-md-4 control-label" for="message">Message</label>
        <div class="col-md-4">
            <textarea class="form-control" id="message" name="message"></textarea>
        </div>
    </div>
    <!-- Button -->
    <div class="form-group">
        <label class="col-md-4 control-label" for="submit"></label>
        <div class="col-md-4">
            <button id="submit" name="submit" type="submit" value="Submit" class="btn btn-outline-inverse btn-lg">Submit</button>
        </div>
    </div>
</fieldset>
</form>

PHP Code Simplified example

 <?php

$emailto  = "example@example.com";
$subject  = "Example subject";
$name     = Trim(stripslashes($_POST['name']));
$email    = Trim(stripslashes($_POST['email']));
$message  = Trim(stripslashes($_POST['message']));
$headers  = "From: example@example.com
";
$headers .= "Reply-To: example@example.com
";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "
";

$body = "<p>You have received a new message:</p>
              <p><strong>Ime: </strong> {$name} </p>
              <p><strong>Email Address: </strong> {$email} </p>
              <p><strong>Poruka: </strong> {$message} </p>";

$success = mail($emailto, $subject, $body, $headers);


if ($success){
    print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";
}
else{
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>

For some reason variables $name, $email and $message appear empty when I receive an email from this contact form/mail function. The rest is shown correctly.

You also need to close the " in the $body variable.

$body = "<p>You have received a new message:</p>
         <p><strong>Ime: </strong> {$name} </p>
         <p><strong>Email Address: </strong> {$email} </p>
         <p><strong>Poruka: </strong> {$message} </p>";

Try this.

$body = "<p>You have received a new message:</p>
         <p><strong>Ime: </strong> ".$name." </p>
         <p><strong>Email Address: </strong> ".$email." </p>
         <p><strong>Poruka: </strong> ".$message." </p>";

The problem was in my htaccess file and not in the code, I had some lines which were removing php and html extensions for estethics, so its all works fine now.