<?php
//connecting to the database and running query

$dbc=mysqli_connect('localhost','root','','sam_telephone');
$get_list_sql="SELECT id, CONCAT_WS(',', l_name, f_name) AS display_name FROM
master_name;";
$get_list_res= mysqli_query($dbc, $get_list_sql);
?>

<!--Building of drop down menu start from here-->

<form action="post.php" method="post">
<select name="sel_id">
<option value="">--Select One--</option>
<!--Starting while loop for fetching the array-->
<?php
while($x=mysqli_fetch_array($get_list_res,MYSQLI_BOTH)){
?>
<option value="<?php $x['id']?>" name="<?php $x['id']?>"><?php echo $x['display_name']?></option>
<?php
}
?>
</select>
<input type="submit" value="submit"/>
</form>
<!--Till here every thing work fine-->


<?php

// this portion is not working what i want to do its to get the id, because if
//I can get the id, i can run the query and get the result which i want to get
// from this table
if(isset($_POST['sel_id'])){
$safe_id = mysqli_real_escape_string($mysqli, $_POST['sel_id']);
echo $safe_id;
}
?>