Jump to content

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>';
}
}
Edited by blmg911
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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.