Re: [PHP] Select value for driopdown box

2003-01-25 Thread Greg Beaver
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

RE: [PHP] Select value for driopdown box

2003-01-25 Thread Ben C.
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

Re: [PHP] Select value for driopdown box

2003-01-22 Thread Jim Lucas
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

Re: [PHP] Select value for driopdown box

2003-01-22 Thread Michael Sweeney
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\"" : ""; $