Jump to content

variable not defining properly


Orionsbelter

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.