Jump to content

Dropdown list question


TimUSA

Recommended Posts

I have this code for a dropdown list, how would i change it so that the names are displayed but the value = the ID_MEMBER #?

$query = "SELECT `memberName` , `ID_MEMBER` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;";
$result = mysql_query($query);


echo'
<SELECT id="name" name="name" style="WIDTH: 160px" value ="';
echo '" />';

if(mysql_num_rows($result)) {
// we have at least one user, so show all users as options in select form
while($row = mysql_fetch_row($result))
{
print("<option value=\"$row[0]\">$row[0]</option>");
}
} else {
print("<option value=\"\">No user in this group</option>");
mysql_data_seek($result, 0);
}

 

Link to comment
https://forums.phpfreaks.com/topic/84420-dropdown-list-question/
Share on other sites

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.