I produced a database with 3 tables being spusername, splocation, sprecord. spusername has id, splocation_id, lastname, firstname. I wish to have the ability to possess a drop lower menu which has drawn id, lastname, firstname in the database, and inside the pulldown it only shows a listing of all of the names being lastname,firstname. then after i choose an individual I've another drop lower which has kinds of learning it. when I hit submit it'll produce a record in another table using the persons id and training record. then when I perform a search it'll pull-up the consumer and also the training records for your person.... I've already produced a submit page inside a .php that transmits lastname, firstname, splocation_id for brand new customers and i believe I can produce a search that does things i would like it to, but I have not designed a data entry carrying out a pulldown which has values produced in the database.

EDIT Code: With the aid of Vegard's coding I acquired this, and today it really works great following a couple of trial and errors. Thanks!

Code:

<?php 
    if (isset($_REQUEST['Submit'])) { 
    $sql = "INSERT INTO $db_table(spusername_id,sptraining_id) values ('".mysql_real_escape_string(stripslashes($_REQUEST['spusername_id']))."','".mysql_real_escape_string(stripslashes($_REQUEST['sptraining_id']))."')";
    if($result = mysql_query($sql ,$db)) { 
    echo '<h1>Thank you</h1>Your information has been entered into the database<br><br>'; 
    } else { 
    echo "ERROR: ".mysql_error(); 
    } 
    } else { 
?> 
<h1>Add Training Information To Database</h1><hr> 
<br><br>
<form method="post" action=""> 
<select name="spusername_id">
    <option value="default">Select Employee</option>
<?php
    include("connectspusers.php"); /*file where you have stored your DB conn. settings*/
    $result = mysql_query('SELECT id, lastname, firstname FROM spusername ORDER BY lastname ASC') or die (mysql_error()); 

    while ($row = mysql_fetch_array($result)) {
        echo '<option value="' . $row['id'] . ' ' . $row['lastname'] . ' ' . $row['firstname'] . '">' . $row['lastname'] . ', ' . $row['firstname'] . '</option>';
    }
?>
</select>

<select name="sptraining_id">
    <option value="default">Select Training</option>
<?php
    include("connectsptraining.php"); /*file where you have stored your DB conn. settings*/
    $result = mysql_query('SELECT id, trainingtype, level FROM sptraining ORDER BY level ASC') or die (mysql_error()); 

    while ($row = mysql_fetch_array($result)) {
        echo '<option value="' . $row['id'] . ' ' . $row['trainingtype'] . ' ' . $row['level'] . '">' . $row['trainingtype'] . ' - ' . $row['level'] . '</option>';
    }
?>
</select>
<br><br>
<input type="submit" name="Submit" value="Submit"> 
</form> 
<?php 
} 
?> 

You develop a choose inside a loop using the data out of your database.

example with mysql (didn't test):

$query = "select id, lastname, firstname from spusername";
$result = mysql_query($query);

  echo "<select>";

  while($row = mysql_fetch_array($result)){
    echo "<option value='".$row['id']."'>".$row['lastname']. "  ". $row['firstname']."</option>";
  }

  echo "</select>";

EDIT: (reaction to your edit)

Inside your code you utilize $row2 rather than $row

<select name="id" size="1">
<?php
  $result=mysql_query("select * from spusername;");
  while($user=mysql_fetch_array($result)) {
    echo "<option value=\"".$user['id']."\">".$user['lastname'].", ".$user['firstname']."</option>";
?>
</select>

Continue on with always using "id" like a mention of user and check out using publish rather than reach send the request(keeps the URL inside your user's browser clean).