I have the following snippet of code that grabs Usernames and displays them based on whether they are active. This code places the result in a selectable drop-down box so you can click the box, scroll to the name you want, select it - and the name stores in the "name" field of a separate table.
<?
$result = mysql_query("SELECT UNum, UName FROM Users WHERE UActive='Yes' ORDER BY UName");
if ($myrow = mysql_fetch_array($result)) {
echo "<select name=name>";
do {
printf("<option>%s</option>\n", $myrow["UName"]);
} while ($myrow = mysql_fetch_array($result));
echo "</select>";
}
?>
Now this is probably easy, but I could not find a similar question here on the boards. I know this is possible in MSAccess...but how do I display the UName field so that you see the names in the drop down box...but STORE the UNum (User-ID field) in the separate table?
So I could select someone's name...and when I hit enter, their User ID would store in the separate table.
Thanks in advance for any help.