Re: Detecting which item too select in a select

From: Date: Wed, 20 Dec 2000 04:08:01 +0000
Subject: Re: Detecting which item too select in a select
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-31154@lists.php.net to get a copy of this message
hmm, this seems to only return the last array item? so the drop down list has one item "Ms" --snip-- $sal = array( "0" => "Mr", "1" => "Mrs", "2" => "Miss", "3" => "Ms"); while (list($key,$val) = each($sal)) { $option = '<option value="' . $val . '"'; if ( $my_account["SALUTATION"] == $val ) { $option .= 'selected '; } $option .= '>' . $val . '</option>' . '\n'; } $tpl->assign('SALUTATION', $option); --snip-- The template has: <select name="salutation"> {SALUTATION} </select> $my_account is an array, the key SALUTATION holds VALUE "Mr" Any ideas why only the last value of the array is returned? Regards Joseph

« previous php.general (#31154) next »