Hi, I am having some trouble echoing into a drop down menu. Instead of the bandnames that I would like to appear, $band is appearing. Here is my code:

<form action="insert.php" method="post">
Band Name <select name="band">
<? $link = mysql_connect(); 
if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
mysql_select_db(); 



    $result = mysql_query("SELECT * FROM bands WHERE Username='$username'");  
 
 
    while($row = mysql_fetch_array($result)) 
    { 
        $band = $row['BandName'] ;
echo '<option value=\"$band\">$band</option>' ;
    }

?>
</select>

I think it may be something to do with putting . $band . or maybe using '$band' as that is what I have seen but these don't seem to be working for me, so I am either way off or making little mistakes.

Any help would be greatly appreciated.

Thanks

Try that

echo "<option value='".$band."'>".$band."</option>";

Thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.