我用ASP做一个简单的用户登陆页面,设置了ACCESS数据库,字段有用户名和密码,只要输入的用户名和密码正确

只要输入的用户名和密码正确,就可以进入想对应的页面。老是要出错呢?现在又增加了一个判断,就是:“用户名和密码正确的情况下,在下拉框中选中一个条件(A或者B),进入相应的页面”。跪求高手啊!!
我现在增加了如图示的一个:“电信”、“网通”的下拉列表,要实现:用户名和密码正确的情况下,登陆相对应的页面。也就是我的二级页面分了电信和网通两张。我上面这段代码是没增加这个判断的,现在要怎么改代码能实现上诉功能?谢谢

假如下拉框 名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
%>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-03-14
在下拉框中选中一个条件(A或者B),就要一个select参数传递一个A或者B来用IF判断取值后转到相应的页面即可,这个比较简单,自己去做是比较容易的,祝你好运!
相似回答