t; -Original Message-
> From: Michael Sweeney [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 10:29 AM
> To: Ben C.
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Select value for driopdown box
>
>
> Assuming that you know which state is selected b
I tried to use the below but it does not work. Please help!
-Original Message-
From: Michael Sweeney [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 10:29 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Select value for driopdown box
Assuming that you know which
function DrawOptions($options, $active='')
{
$str = '';
foreach($options AS $key=>$value)
{
$sel = ($active==$key?" SELECTED":"");
$str .= "".$value."\n";
}
return($str);
}
Try this
array needs to be a key-value pair that has the value that you are looking
for as the key and
Assuming that you know which state is selected before you build the
select list:
$sel_state = $_REQUEST['state'];
...
while($row = mysql_fetch_array($result)) {
$buyerid = $row['buyerid'];
$state = $row['state'];
$selected = $state == $sel_state ? "selected=\"selected\"" : "";
$
4 matches
Mail list logo