Thanks to all that helped with this hopefully someone else finds it useful.
To customize this for your purposes change the member group numbers.
$query = "SELECT `memberName` 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);
}
the list works but it doesn't really do anything ! maybe if it would get you to the selected member's profile , or (even better) it would show underneath the list a short profile of the member ...
That would be up to you...this is just getting the name. you could then use $_POST['name'], or $_GET['name'] to do what ever you wanted.
ok , thnx !
have a quick question regarding this. I realized when I created this that I wanted to get a list of names in a dropdown list to insert into a txt field. now what I am realizing as I advance further in the project that I am working on that I need the names to be printed, but the value to be ID_MEMBER, as that is the primary key to be shared in other tables. anyone want to have a stab at this?
Change
$query = "SELECT `memberName` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;";
to
$query = "SELECT `memberName`, `ID_MEMBER` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;";
and change
print("<option value=\"$row[0]\">$row[0]</option>");
to
print("<option value=\"$row[1]\">$row[0]</option>");