PHP,从表单获取值(包含来自数据库的数据,在循环中)

I am trying to get the value of a form element which as a name value as an ID from the data base, the code is

while ($row = $result->fetch_assoc()) {

                           unset($id, $name);
                           $id = $row['D_ID'];
                           $name = $row['d_name']; 
                           echo '<option name="'.$id.'">'.$name.'</option>';

                       }

                       echo "</select>";

The other code where the value of the name is retrieved is as follows

$degree = $_POST['degree'];
$tavail = $_POST['tavail'];
$appoint = $_POST['choice'];
$logg = $_POST['.$id.']; 
echo $logg;  // The id value from the option name 

But there is an error regarding that line, Undefined Index I want to know how can I get the value from that option tag when the name is a variable itself