asp中无法获取表单的数据
<%dimrssetrs=Server.CreateObject("ADODB.Recordset")sql="select*fromuser_regwhereuser_...
<%
dim rs
set rs=Server.CreateObject("ADODB.Recordset")
sql= "select * from user_reg where user_name ='" & session("user_name") &"'"
rs.open sql,db,3,2
%>
<form name="form1" method="post" action="update_submit.asp" >
<p align="center">修改用户信息</p>
<table width="406" border="0" class="table_small">
<tr>
<td width="10"> </td>
<td width="115" class="text"><div align="left">用户名:</div></td>
<td width="176" class="text"><div align="left">
<label>
<input type="text" name="username" value=<%=rs("user_name")%> readonly="true">
</label>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">电子邮件:</div></td>
<td class="text"><div align="left">
<input name="email" type="text" class="textfield" id="email" value=<%=rs("email")%>>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">电话:</div></td>
<td class="text"><div align="left">
<input name="tel" type="text" class="textfield" id="tel" value=<%=rs("tel")%>>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">原始密码:</div></td>
<td class="text"><label>
<div align="left">
<input type="password" name="OriPwd">
</div>
</label></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">新密码:</div></td>
<td class="text"><div align="left">
<input type="password" name="Pwd">
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">新密码确认:</div></td>
<td class="text"><div align="left">
<label>
<input type="password" name="Pwd1">
</label>
</div></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><label>
<div align="center">
<input type="submit" name="Submit" value="提交">
</div>
</label></td>
</tr>
</table>
</form>
数据提交到得页面
<%
dim sql, vTel,vUserPwd, vname, vEmail
vname=request.form("username")
vEmail = Request.Form("email")
vTel=request.Form("tel")
OriPwd = Request.Form("OriPwd")
psw = Request.Form("Pwd")
psw1=request.Form("pwd1")
if OriPwd="" then ErrorMsg="请输入原密码!"
if psw<>psw1 then ErrorMsg="新的密码和确认密码不一样!"
sql = "SELECT * FROM user_reg WHERE user_name='" & vname & "' And psw='" & OriPwd & "'"
Set rs = db.Execute(sql)
If rs.Eof Then
Response.Write "密码错误!"
%>
<Script Language="JavaScript">
setTimeout("history.go(-1)",1600);
</Script>
<%
Response.End
Else
'更新用户信息
sql = "UPDATE user_reg SET email='"& vEmail &"',psw='"& Pwd &"',tel='"& vTel &"'Where user_name='" & vname & "'"
'response.Write("hehe")
db.Execute(sql)
Response.Write "<h2>用户信息已成功保存!</h2>"
response.End()
end if
%>
%>
请教高手指教了,不甚感激! 展开
dim rs
set rs=Server.CreateObject("ADODB.Recordset")
sql= "select * from user_reg where user_name ='" & session("user_name") &"'"
rs.open sql,db,3,2
%>
<form name="form1" method="post" action="update_submit.asp" >
<p align="center">修改用户信息</p>
<table width="406" border="0" class="table_small">
<tr>
<td width="10"> </td>
<td width="115" class="text"><div align="left">用户名:</div></td>
<td width="176" class="text"><div align="left">
<label>
<input type="text" name="username" value=<%=rs("user_name")%> readonly="true">
</label>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">电子邮件:</div></td>
<td class="text"><div align="left">
<input name="email" type="text" class="textfield" id="email" value=<%=rs("email")%>>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">电话:</div></td>
<td class="text"><div align="left">
<input name="tel" type="text" class="textfield" id="tel" value=<%=rs("tel")%>>
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">原始密码:</div></td>
<td class="text"><label>
<div align="left">
<input type="password" name="OriPwd">
</div>
</label></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">新密码:</div></td>
<td class="text"><div align="left">
<input type="password" name="Pwd">
</div></td>
</tr>
<tr>
<td> </td>
<td class="text"><div align="left">新密码确认:</div></td>
<td class="text"><div align="left">
<label>
<input type="password" name="Pwd1">
</label>
</div></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><label>
<div align="center">
<input type="submit" name="Submit" value="提交">
</div>
</label></td>
</tr>
</table>
</form>
数据提交到得页面
<%
dim sql, vTel,vUserPwd, vname, vEmail
vname=request.form("username")
vEmail = Request.Form("email")
vTel=request.Form("tel")
OriPwd = Request.Form("OriPwd")
psw = Request.Form("Pwd")
psw1=request.Form("pwd1")
if OriPwd="" then ErrorMsg="请输入原密码!"
if psw<>psw1 then ErrorMsg="新的密码和确认密码不一样!"
sql = "SELECT * FROM user_reg WHERE user_name='" & vname & "' And psw='" & OriPwd & "'"
Set rs = db.Execute(sql)
If rs.Eof Then
Response.Write "密码错误!"
%>
<Script Language="JavaScript">
setTimeout("history.go(-1)",1600);
</Script>
<%
Response.End
Else
'更新用户信息
sql = "UPDATE user_reg SET email='"& vEmail &"',psw='"& Pwd &"',tel='"& vTel &"'Where user_name='" & vname & "'"
'response.Write("hehe")
db.Execute(sql)
Response.Write "<h2>用户信息已成功保存!</h2>"
response.End()
end if
%>
%>
请教高手指教了,不甚感激! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询