Okay I have the following code so far.

         $sql = "SELECT stass_warrior FROM staff_assignments WHERE 
stass_pos = $pos_id AND stass_weekend = $initiation";
         if (!$query = mysql_query($sql))        error(mysql_error());
         $query = mysql_fetch_row($query);

         $sql = "SELECT war_id, CONCAT(war_lname, ', ', war_fname) FROM 
warrior, staff_roster WHERE war_id != 1 AND staff_weekend = $initiation AND 
staff_warrior=war_id ORDER BY war_lname";
         if (!$res = mysql_query($sql))  error(mysql_error());

         echo TTT . '<th class="format" width="25%">' . $row[1] . '</th>' . B;
         echo TTT . '<td class="format">' . B;
         echo TTT . '<select name="position_' . $n . '[]" size="5" 
multiple>' . B;
         while($rec = mysql_fetch_row($res))     {
                 ($query[0] == $rec[0] ? $selected =" selected" : $selected 
= "");
                 printf("\t\t\t\t<option value=\"%s_%s\"%s>%s</option>\n", 
$pos_id, $rec[0], $selected, $rec[1]);
         echo TTT . '</select>' . B;
         echo TTT . '</td>' . B;

Now my problem is with the multiple feature of the drop down menu.
The first query to the db resulting in the $query variable may contain more 
then one result.
However only the last result will appear with the selected option.

I need some code that is is going to display the selected option next to 
all the correct results in the drop down.
Understand what I am needing?

Thanks for your help

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to