📄 update.asp
字号:
<!--#INCLUDE FILE="../odbc_connection2.asp"-->
<html>
<head>
<title>修改个人信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function check_Null(){
if (document.form1.realname.value==""){
alert("真实姓名不能为空!");
return false;
}
if (document.form1.address.value==""){
alert("通讯地址不能为空!");
return false;
}
if (document.form1.postalcode.value==""){
alert("邮政编码不能为空!");
return false;
}
if (document.form1.email.value==""){
alert("E-mail不能为空!");
return false;
}
return true;
}
// -->
</script>
</head>
<body>
<br>
<table width="607" border="0" align="center">
<tr>
<td width="605" align="center" bgcolor="#FFFFFF">
<table width="90%" border="0">
<tr>
<td height="40" align="center"><h3><font color="#AB0000">修改个人信息</font></h3></td>
</tr>
<tr>
<td height="30"><hr size="1" noshade></td>
</tr>
</table>
<form name="form1" onsubmit="javascript: return check_Null();" action="" method="post">
<table width="80%" border="0" cellPadding="4" cellSpacing=1 borderColorLight="#cccccc" borderColorDark="#ffffff" bgcolor="#999999">
<%
dim strSql,rs
strSql="Select * From users Where UserId='" & session("UserId") & "'"
Set rs=db.Execute(strSql)
%>
<tr bgcolor="#FFFFFF">
<td width="21%" height="25">用户名</td>
<td width="79%"><%=session("UserId")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td >真实姓名</td>
<td ><input size=15 name="realname" type="text" value="<%=rs("realname")%>">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td >通讯地址</td>
<td ><input size=40 name="address" type="text" value="<%=rs("address")%>">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td >邮政编码</td>
<td ><input size=15 name="postalcode" type="text" value="<%=rs("postalcode")%>">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td >性别</td>
<td ><input type="radio" name="sex" value="男" <%If rs("sex")="男" Then Response.Write "checked" %>>男
<input type="radio" name="sex" value="女" <%If rs("sex")="女" Then Response.Write "checked" %>>女</td>
</tr>
<tr bgcolor="#FFFFFF">
<td >电话 </td>
<td><input type="text" size="25" name="tel" value="<%=rs("tel")%>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td >E-mail </td>
<td><input type="text" size="40" name="email" value="<%=rs("email")%>">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>QQ号码 </td>
<td><input type="text" size="15" name="QQ" value="<%=rs("QQ")%>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td valign="top">个人简介</td>
<td><textarea name="intro" rows="7"cols="50" ><%=rs("intro")%></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td valign="top">购买数量</td>
<td><%=rs("TotalNum")%>本</td>
</tr>
<tr bgcolor="#FFFFFF">
<td valign="top">购买金额</td>
<td><%=rs("TotalMoney")%>元</td>
</tr>
</table>
<p align="center">
<input type="submit" value=" 确 定 " name="submit" class="inputbutton">
</form>
<%
If Request.Form("realname")<>"" And Request.Form("email")<>"" Then
'下面组织SQL语句,因为某些项目允许为空,所以需要判断一下
strSql="Update users Set realname='" & Request.Form("RealName") & "'"
strSql=strSql & ",email='" & Request.Form("email") & "'"
strSql=strSql & ",sex='" & Request.Form("sex") & "'"
strSql=strSql & ",Address='" & Request.Form("address") & "'"
strSql=strSql & ",postalcode='" & Request.Form("postalcode") & "'"
If Request("QQ") <> "" Then
strSql = strSql & ",QQ='" & Request.Form("QQ") & "'"
Else
strSql = strSql & ",QQ=NULL"
End If
If Request("tel") <> "" Then
strSql = strSql & ",tel='" & Request.Form("tel") & "'"
Else
strSql = strSql & ",tel=NULL"
End If
If Request("intro") <> "" Then
strSql = strSql & ",intro='" & Request.Form("intro") & "'"
Else
strSql = strSql & ",intro=NULL"
End If
strSql=strSql & " Where UserId='" & Session("UserId") & "'"
db.Execute(strSql)
'关闭对象
db.close
set db=nothing
Response.Redirect "../index.asp"
End If
%>
<td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -