Welcome to Geeklog, Anonymous Thursday, February 29 2024 @ 08:19 pm EST

Geeklog Forums

drop down


nctek

Anonymous
I searched, but couldn't find anything on this, except one thing, but that wasn't useful. What I need to do is make a drop down list of usernames. I have absolutely no idea how to do this, but what I have come up with so far is <select name="author"> <option selected="selected" value="0">{lang_all}</option> {author_option_list} </select> This is from the search.thml file. It pulls out a list of authors, but it only pulls out a list of authors that have made contributions. I need to get all the users list. How can I do this? I am not using any of the template files, so I would just need to make it in a PHP file either using HTML or something. :-/ Please help! :-( nctek.net
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Add: require_once('lib-common.php'); at the top of your file then this snippet will generate a drop down menu of all users: $display = '<select name="users">'; $result = DB_query("SELECT uid, username FROM {$_TABLES['users']} ORDER by username"Wink; $numrows = DB_numRows($result); for ($i = 1; $i <= $numrows; $i++) { $A = DB_fetchArray($result); $users .= '<option value="' . $A['uid'] . '">' . $A['username'] . '</option>'; } $display .= $users . '</select>'; echo($display);
 Quote

nctek

Anonymous
THANKS!!! That worked, but I'm still having one more problem. http://www.nctek.net/memo_send.php Whenever I have the drop down list then I try to send a message, it says that user name does not exist. Any idea why? How would I go about fixing this? THANK YOU in advance---~nish visit: nctek.net
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
The page cannot be found The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
 Quote

nctek

Anonymous
Yeh, it was renamed, but I have decided that I wont use drop down menu's and the person can just type the name in. Its cool..Thanks for the help though Dirk.---~nish visit: nctek.net
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Geeklog also has a nice COM function to make coding the Select Dropdown input fields easier. It will perform the SQL query and build the HTML select options. Using the same example: $display = '<select name="users">'; $display .= COM_optionList($_TABLES['users'],'uid','username') . '</select>'; echo($display); Blaine
Geeklog components by PortalParts -- www.portalparts.com
 Quote

nctek

Anonymous
i added this code, and made the list of users just as a list so they can get user name from it becaues it doesn't seem to work for some reason. I have absolutely no idea why. It keeps saying, the user does not exist. http://www.nctek.net/send.php <INPUT TYPE="text" NAME="username" VALUE="<?php echo $_GET['to']; ?>"> thanks for the help guys, nctek.net <?php $display = '<select name="users">'; $display .= COM_optionList($_TABLES['users'],'uid,username',$A['users'],1) . '</select>'; echo($display); ?>---~nish visit: nctek.net
 Quote

All times are EST. The time is now 08:19 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content