I've got a small query that fills in a drop down list with a first and last name, and that is the value I want for that drop down list only. However I would also like for a hidden value with the selected name's email address added to the form.
My select fill-in code is:
<select name=techname>
$res = mysql_query("SELECT tech_last, tech_first, tech_email FROM $table2 ORDER BY tech_last")
or die("Unable to pull Tech Information" . mysql_error());
for($i = 0; $i < mysql_num_rows($res); $i++)
{
$temp = mysql_fetch_row($res);
print("<option value=\"$temp[0], $temp[1]\">$temp[0], $temp[1]</option>\n");
}
</select>
So I get the obvious list of people where the value is "lastname, firstname". I want to make it so whenever a name is selected it also takes the email address ($temp[2]) and correctly associates it with the selected name.
Do I need to make a seperate query to do this or is there some way to add it into the above code? How would I go about it either way?
Nico