Well, if you're querying the technician, techemail columns (in that order), then the code I posted should have made a select <option> tag that looks like (using technician Nico with email Nico@worksite.com):
<option value="Nico|nico@worksite.com">Nico</option>
When using fetch_row(), you're fetching the named columns into an indexed (not associative) array which is stores results in the same order as the columns were named in the SELECT query. So if you're query is:
SELECT technician, techemail FROM table...";
When you run fetch_row(), your results will follow the same order as your query:
while($row = mysql_fetch_row($result)) {
// since technician was the first column in the query,
// It'll be the first element (0) of the $row array:
$technician = $row[0];
$techemail = $row[1];
}
Change the order in the select statement, and you need to change the way those results are handled when using fetch_row().
Suggestions... once the select menu is generated, view the HTML source in your browser window. Is it what you expected?
Once the form is submitted back to the server, view the values of your variables to be sure they are what you'd like them to be; the same is true once you explode the 'composite' value.
Keep this function handy somewhere to throw arrays at and display their values:
function ViewArray($a) {
if(!is_array($a)) {
echo 'Supplied argument is not an array.';
return;
}
while(list($k,$v)=each($a)) {
echo "$k = $v <br />\n";
}
}
Throw any array at it, it prints out the values. (Actually I use a much more complete utility which traverses nested arrays, but this'll do for now.)
Before the you go and send an email, echo all the values. Make sure they are what you think they are... A few echo statements on the screen can save plenty of headaches later...