Orionsbelter Posted February 7, 2014 Share Posted February 7, 2014 (edited) I'm running a function and within the function is coding that helps populate a drop down with brand names for a product. If the brand from the mysql database with is defined and working as $cue_brand matches the populated option it should be putting in the selected coding. However it is not, the options are populating correctly and the $cue_brand is correct so I can not see what the issue might be if($drop_type=="brand"){ $type_query=mysql_query("SELECT * FROM `brands` ORDER BY `brand` ASC "); while($get_type=mysql_fetch_object($type_query)){ if($cue_brand=="$get_type->brand"){$selected="selected='selected'";}else{$selected="";} echo '<option value="'.$get_type->brand.'" '.$selected.'>'.$get_type->brand.'</option>'; } } Edited February 7, 2014 by blmg911 Quote Link to comment Share on other sites More sharing options...
requinix Posted February 7, 2014 Share Posted February 7, 2014 Where is $cue_brand coming from? Is it from outside the function or did you pass it in as an argument? Or in other words, how about posting a bit more of your code? Namely the entire function definition and the place where you call 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.