Hi have this code working on my site but I want it to detect and switch from a sql query.. can this be done?


PHP Code:
<select name="club_id">
        <?php

        
switch ($club_id)
        {
            case 
"2":
                
$opt2 " selected ";
                break;
            case 
"3":
                
$opt3 " selected ";
                break;
            case 
"4":
                
$opt4 " selected ";
                break;
            case 
"5":
                
$opt5 " selected ";
                break;
            case 
"6":
                
$opt6 " selected ";
                break;
            case 
"8":
                
$opt8 " selected ";
                break;
            case 
"9":
                
$opt9 " selected ";
                break;
            

        }

    
?>

      <option <?php echo $opt2?> value="2">Auckland</option>
                  
    </select>