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"; } Thanks, Eddie -----Original Message----- From: Jeroen Serpieters [mailto:[EMAIL PROTECTED] Sent: Friday, May 21, 2004 12:16 AM To: Edward Peloke Cc: 'php-general' Subject: Re: [PHP] array_push On Fri, 21 May 2004, Edward Peloke wrote: > > $sql=new Database(); > $sql->query("select fname,lname, id from clients"); > $clients[]=array(); > while($sql->nextRecord()){ > array_push($clients, $sql->getField('id')=>$sql->getField('fname')); > } // while > > Parse error: parse error, unexpected T_DOUBLE_ARROW in > C:\obox\Apache2\htdocs\nh_vacdest\admin\test.php on line 38 > If you want to do it the way you're doing now you should do ik like this: array_push($clients, array($sql->getField('id')=>$sql->getField('fname'))); Another possible solution is like this: $clients[$sql->getField('id')] = $sql->getField('fname'); -- Jeroen There are only two kinds of programming languages: those people always bitch about and those nobody uses. -- Bjarne Stroustrup -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php