Hi guys, back again!
OK, this is what I am sitting with now. I have to select a person from the database and in the select box display their first, middle, and last names. The data returned should be the fields id to insert into the foreign key id of the related table.
This is what I have at the moment but, as usual with me, it is not working!
<form method="post" action="">
<table width="100%" align="left" border="0" cellspacing="1" cellpadding="2">
<tr>
<td><label for="person_id">Person</label></td>
<td>
<select name="person_id" id="person_id">
<option value="">--- Select a Person ---</option>
<?php
$sql_select = "SELECT * FROM person order by last_name asc";
$retval_selectperson = mysql_query( $sql_select, $conn );
if(! $retval_selectperson ) { die('Could not select data: ' . mysql_error()); }
while($row = mysql_fetch_assoc($retval_selectperson)) {
echo '<option value='.$row["first_name"]. " " . $row["middle_name"]. " " . $row["last_name"]'>'.$row["first_name"]." " .$row["middle_name"]. " " .$row["last_name"].'</option>';
}
?>
</select>
</td>
</tr>
Where have I gone wrong?