Hi guys, i have some code that populates a dropdown list from my database, (email addresses) however some of the people don't have email addresses and it creates blank spaces in the dropdown list.. is there anyway to remove those blank spaces? here's the code.
<%
Option Explicit
'declare variables
Dim conn, sql, rsEmployees
'connect to db and open our query
Set conn = Server.CreateObject("ADODB.Connection"
conn.open "DSN=Employees"
sql="SELECT Email FROM Employees"
Set rsEmployees = conn.execute(sql)
%>
<html>
<head>
<title>
Database Drop Down Menu
</title>
</head>
<body>
<form action="../../form2.asp" method=post>
<select name="TelmonEmail">
<%
If Not rsEmployees.EOF Then
rsEmployees.MoveFirst
Do
Response.Write("<option value=""" & rsEmployees("Email" & """>" & _
rsEmployees("Email" & "</option>"
rsEmployees.movenext
Loop Until rsEmployees.EOF
End If
conn.close
Set conn=Nothing
Set rsEmployees=Nothing
%>
</select>
</form>
</body>
</html>
Thanks
<%
Option Explicit
'declare variables
Dim conn, sql, rsEmployees
'connect to db and open our query
Set conn = Server.CreateObject("ADODB.Connection"
conn.open "DSN=Employees"
sql="SELECT Email FROM Employees"
Set rsEmployees = conn.execute(sql)
%>
<html>
<head>
<title>
Database Drop Down Menu
</title>
</head>
<body>
<form action="../../form2.asp" method=post>
<select name="TelmonEmail">
<%
If Not rsEmployees.EOF Then
rsEmployees.MoveFirst
Do
Response.Write("<option value=""" & rsEmployees("Email" & """>" & _
rsEmployees("Email" & "</option>"
rsEmployees.movenext
Loop Until rsEmployees.EOF
End If
conn.close
Set conn=Nothing
Set rsEmployees=Nothing
%>
</select>
</form>
</body>
</html>
Thanks