假如下拉框 名select_name,下面代码与用户名验证码同放在一表单中,表单名为 form1
<select name="select_name">
<option value="电信">电信</option>
<option value="网通">网通</option>
</selcet>
<%
dim conn,connstr
connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("data.mdb")
set conn=Server.Createobject("adodb.connection")
conn.Open connstr
username=request.form("username")
username=right(username,len(username)-2)
password=request.form("password")
password=right(password,len(password)-2)
set rs=Createobject("adodb.Recordset")
sql="select * from user where username= '"&username&"' and password ='"&password&"'"
'response.write(sql)
rs.open sql,conn,1,3
if not rs.eof or not rs.bof then
if request.form("select_name")="电信" then
response.redirect"index_1.html"
else
response.redirect"index_2.html"
end if
else
Response.Write("<script language=javascript >alert('用户名或密码错误!');window.navigate('index.htm');</script>")
%>
<%end if%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
温馨提示:答案为网友推荐,仅供参考