Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Select - Form Element memberlist dropdown

Aloittaja TimUSA, joulukuu 22, 2007, 05:10:46 IP

« edellinen - seuraava »

TimUSA

I need to create a selection form element that is a drop down list for members in a certain member group array.

currently I am using the "action=findmember code":
<input type="text" name="name" id="name" value="', $context['name'], '" tabindex="', $context['tabindex'], '" size="40" /> <a href="', $scripturl, '?action=findmember;input=name;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" /></a> <a href="', $scripturl, '?action=findmember;input=name;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);">', $txt['find_members'], '</a>

This does not work because when you it puts the Member name in quotes, amongst other problems later in the code.

any suggestions on how to do this?


SleePy

What methods have you tried?
You would need to query all members in that group and output them. Depending on if you are using SSI.php or not will tell if you have to do this manually or if you could use a mod (for ssi)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

TimUSA

sorry I forgot to mark this as solved, but just for the record here is what i came up with:
$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);
}

Advertisement: