> $val = array("000","050","100");
> $val_name = array("Low","Medium","High");
> $count = count($val);
> $counter = 0;
> while ($counter < $count)
> {
> if ($val[$counter] == $priority)
> {
> $selected = " selected";
> }
> echo "<option
> value=\"$val[$counter]\"$selected>$val_name[$counter]</option>";
> $counter++;
> }

Not quite... You need to reset $selected so that you don't end up with them
all being selected when $priority="000". It's a pretty clever idea, though.

I've rearranged stuff a bit to make it look prettier, and to match the
original functionality closer. Nothing personal, but I can't stand it when
people use while for stuff that looks prettier as a for. =)

$val = array("000","050","100");
$val_name = array("High","Medium","Low");
$fcol_name = array("high","med","low");
$count = count($val);
for ($counter = 0; $counter < $count; $counter++) {
 $selected = "";
 if ($val[$counter] == $priority) {
  $selected = " selected";
  $fcol = fcol_name[$counter];
 } //if
 $pstr .= "<option
value=\"$val[$counter]\"$selected>$val_name[$counter]</option>\r\n";
} //while

Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very funny Scotty, now beam down my clothes!"
Come back tomorrow for a different sig!
Backspace a single "s" to reply by email


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to