tigomark Posted August 15, 2008 Share Posted August 15, 2008 Ok I am trying to first get a list of stuff from an array created from a database. I am able to do that in funcion LeftSelect but what I would like to do is separate out values that are grabbed from another call and stored in $this->right_asset (vars 1,2,3,4) the values then would populate the RightSelect function LeftSelect(){ $assets = loadAllStuff($getConnection); $html = "<select name=\"target\" multiple=\"multiple\">\n"; if(is_array($assets)){ while(list ($key, $val) = each($assets)){ if (in_array($val->id, $this->asset_select_right)) { array_push($this->right_asset,($val->id, $val->stuff)); }else{ $html .= sprintf("<option value=\"%d\">%s</option>\n", $val->id, htmlspecialchars($val->stuff)); } } } $html .= "</select>\n"; return($html); }//assetSelect function RightSelect(){ $html .=sprintf(" <select name=\"selected\" size=\"10\">"); if(is_array($this->right_stuff)){ while(list($key, $val) = each($this->right_stuff)){ $html .= sprintf("<option value=\"%d\">%s</option>\n", $val->id, htmlspecialchars($val->stuff)); } } $html .=sprintf("</select>"); return($html); } I am trying if (in_array($val->id, $this->asset_select_right)) { array_push($this->right_asset,($val->id, $val->stuff)); which is currently not working in the left. If I take out the if I do get the all of the values so that is working. and the RightSelect is all fubar so I am kinda stuck. Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 15, 2008 Share Posted August 15, 2008 Don't give up man. Walk around for a few minutes to clear you head, think about what exactly you are trying to do, and I'm sure you'll get it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.