On Fri, 21 May 2004, Edward Peloke wrote:

> How do I then cycle through this array to build the select box?  I
> currently use this which works fine when I hard code the values..ie.
> $yesno=array("Yes"=>"1","No"=>"0")  but doesn't seem to work using your
> first option.
>
> Here is the form select box code
>         while($value=each($array))
>         {
>             $res .= "<option " .$selected. ($selected == $value['value']
> ? " selected=\"selected\"" : '') . "
> value=".$value['value'].">".$value['key']."</option>\n";
>         }
>

I'm not sure about what you mean, cause these variables have other names
than before :-)

But what I think you mean is this:

foreach( $clients as $id => $name )
        echo "<option value=\"{$id}\">{$name}<option>";

Correct me if this isn't what you meant.

-- 
Jeroen

Like the creators of sitcoms or junk food or package tours, Java's designers were 
consciously designing
a product for people not as smart as them.
        -- Paul Graham

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

Reply via email to