Issue with select list dropdown on insert

I’m having an issue with inserting details from a populated select list. I have referenced the option values by id - $row[‘id’] - and I would have thought that this would have been the value that would be taken when the form is sent. The form allows the addition of items but the value added appears to be 0. With the fname reference in $_POST[‘fname’], I would have thought that the id value would have been populated in the table when inserted as this is the value taken as the option value.

Below is the code. Perhaps you might be able to point me to a way of getting the id inserted.


$query = "SELECT fname FROM person";
$result = mysql_query($query) or die(mysql_error());

$dropdown = "<select name='fname'>";
	while($row = mysql_fetch_assoc($result)) {
	  $dropdown .= "\\r\
<option value='{$row['id']}'>{$row['fname']}</option>";
$dropdown .= "\\r\

echo '<table>';
echo '<form method = "post" action = "insert.php">';
echo '<tr>';
echo '<td>Firstname</td><td>'.$dropdown.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td></td><td><input type = "submit" name = "submit" value = "Send"></td>';
echo '</tr>';
echo '</form>';
echo '</table>


$sql = "INSERT INTO new (fname_id) VALUES ('".$_POST['fname']."')"; 
$query = "SELECT id,fname FROM person";