Orionsbelter Posted February 7, 2014 Share Posted February 7, 2014 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>'; } } Link to comment https://forums.phpfreaks.com/topic/286020-variable-not-defining-properly/ 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. Link to comment https://forums.phpfreaks.com/topic/286020-variable-not-defining-properly/#findComment-1468082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.