Samurai Legend Posted October 24, 2014 Share Posted October 24, 2014 How would I make a drop down list of users from a clan? Has to be a drop down list of their members in their clan. [ATTACH=CONFIG]1715[/ATTACH] I want to replace that to a drop down list Quote Link to comment Share on other sites More sharing options...
G7470 Posted October 24, 2014 Share Posted October 24, 2014 (edited) What you will want to do first is run a query (if not already done) to see what users are in their clan: $res = $db->query("SELECT * FROM `users` WHERE `gang` = '".$ir['gang']."'"); OR, if you do not have the current user's clan saved in a variable or in a class: $res = $db->query("SELECT * FROM `users` WHERE `gang` = (SELECT `gang` FROM `users` WHERE `id` = '".$ir['userid']."')"); Then, once you have that information, you can then create a loop like this: echo "<select name='vpdropdown'>"; echo "<option value='0'>None Selected</option>"; while ($qres = $db->fetch_row($res)) { echo "<option value='".$qres['userid']."'>".$qres['username']."</option>"; } echo "</select>"; Then, once you have that, all you would have to do to find the value is to do is get the value of the "vpdropdown" using $_GET or $_POST as well as check to make sure that the value is not zero. I would also run a check (if not done already) to verify that the ID of the user given is in fact in the clan. Hopefully all of that makes sense haha. If you have any questions, let me know or post here so others may answer. ~G7470 Edited October 24, 2014 by G7470 Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted October 24, 2014 Share Posted October 24, 2014 You could also open up global_func.php and see how they do the user drop down Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted October 28, 2014 Author Share Posted October 28, 2014 Thank you guys so much! You guys are amazing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.