提交 from 后 $_POST 数组为空

$_POST array is empty after submitting the from

我有一个简单的表格(如下),我想在电子邮件中发送名称字段,但 POST 是空的。

HTML 形式:

<form action="contact.php" method="post">
   <div class="form-group">
     <label for="name">Name:</label>
     <input type="text" class="form-control" id="name">
   </div>
   <button type="submit" class="btn btn-default">Submit</button>
</form>

PHP:

<?php
if (isset($_POST['name'])){
    $to = "example@example.com";
    $subject = "Test subject";
    $txt = $_POST['name'];
    $txt .= "test txt";
    $headers = "From: example2@example2.com" . "\r\n" .
    "CC: somebodyelse@example.com";
    if (mail($to,$subject,$txt,$headers)){
        echo "succes";
    }else{
        echo "failed";
    }
} else {
    echo "Name is required!";
}
?> 

有谁知道哪里出了问题?我在这个服务器上还有其他表格,它们工作正常。

输入必须具有 name 属性。

<input type="text" class="form-control" id="name" name="name">