Solved

Dropdown with usernames from database using Frontpage

Posted on 2006-06-23
4
227 Views
Last Modified: 2013-12-24
What I would like is on my login page have the usernames displayed in a dropdown list.  The user can choose their username from the list and then type in their password.

The database is called admin.mdb and the field I want to display is username

Thanks
0
Comment
Question by:Shaft960
4 Comments
 
LVL 2

Accepted Solution

by:
Eme-Eleonu earned 500 total points
Comment Utility
Just plug this into your page

<!-- Start First Drop Down -->
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("login_connectionstring")
Set objRS = objDC.Execute("SELECT Distinct username FROM Table")
%>
<FORM METHOD="POST" NAME="Form1">
<font face="Arial">Choose Your
    Username </font>
<SELECT NAME="username" SIZE="1" ONCHANGE=Form1.submit()>
<option selected><% = Request.Form("username") %></option>
<%
' Continue until we get to the end of the recordset.
Do Until objRS.EOF
' For each record we create a option tag and set it's value to the Department
%>

<OPTION><%= objRS("username") %></OPTION>
            <%
      ' Get next record
      objRS.MoveNext
      Loop
      %>
      </SELECT> </p>
      </FORM>
<%
' Close Data Access Objects and free DB variables
objRS.Close
Set objRS =  Nothing
objDC.Close
Set objDC = Nothing
%>
<!-- End first Drop Down -->

<!--Password Field-->
<%
'Some code to hide the password until we make a username is selected from the first
IF Request.Form("username") = "" Then
Else
'If username has a value then we allow user to enter password
%>
<FORM METHOD="POST" NAME="Form2">
<input type="password" name="Password" size="20">
<%
'Set a hidden value in the second form for the username
'so we can pass it along with the city to the next query %>
<input type="submit" value="Log In Now" name="Submit">
<input type="hidden" name="username" value="<% = Request.Form("username") %>"
</FORM>
<% End IF %>
<!-- End -->
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now