> Hey all.  Does anyone have any ideas how I can carry over a selected
value?
> :)  It's probably easy but my mind is making it difficult.  A value is
> stored for a record in the DB which had been previously assigned through a

#get all the possible options into an array $options
$options = array('red', 'yellow', 'green');
#get the selected option into a variable $option
$option = 'yellow';
echo "<SELECT>\n";
while (list(,$opt) = each($options)){
    $selected = ($opt == $option) ? 'SELECTED' : '';
    echo "<OPTION $opt $selected>$opt</OPTION>\n";
}
echo "</SELECT>\n";

Twist on a theme:
If you can have a pre-determined order, you can have this work with multiple
selections, but only advancing the selected array (or result set or
whatever) when you have a match.

Don't miss the Zend Web Store's Grand Opening on January 23, 2001!
http://www.zend.com
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
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