I find myself asking the database for the same information, sometimes in the same script. I'd like to save the data in an array, then output the data in a <select><option> drop down.

So far I've got the data in an array called $agentList like so:

Code PHP:
$agentList = array();
 
$q = "SELECT 
		admin_id, first_name, last_name
	FROM
		admins
	ORDER BY 
                last_name";
 
$r = @mysqli_query($dbc, $q);
 
while ($rows = mysqli_fetch_assoc($r)) {
	$agentList[] = $rows;
}

The array data looks like this:

Code PHP:
Array (
    [0] => Array
        (
            [admin_id] => 40
            [first_name] => Tom
            [last_name] => Clemente
        )
 
    [1] => Array
        (
            [admin_id] => 47
            [first_name] => Thomas
            [last_name] => Conlin
        )
 
    [2] => Array
        (
            [admin_id] => 45
            [first_name] => Bob
            [last_name] => Deangelis
        )
 
    [3] => Array
        (
            [admin_id] => 62
            [first_name] => Gabby
            [last_name] => Gascon
        )
)

I'm lost after that. I'd like the data to output:

Code HTML4Strict:
<select name="agent">
  <option value="40">Tom Clemente</option>
  etc...

Any help is much appreciated and will only make me a better programmer!