📄 edittype1.asp
字号:
<%
if session("cjuser")="" and session("pwdd")="" then
response.write"<SCRIPT language=JavaScript>alert('你没有登录,无权进入!');"
response.write"this.location.href='error.htm';</SCRIPT>"
response.end
end if
%>
<!--#include file=../conn/adodb1.asp -->
<%
action=request("action")
if action="add" then '添加类型
type_name=request("type_name")
if type_name="" then
Response.Write("<script>alert('类型不能为空,请填写!');window.location='edittype1.asp';</script>")
response.end
end if
set rs=db.execute("Select * from class_housetype Where housetype='"&type_name&"'")
if not rs.eof then
Response.Write("<script>alert('类型不能重复,请重填!');window.location='edittype1.asp';</script>")
response.end
else
set rs=server.createobject("adodb.recordset")
rs.open "select * from class_housetype",db,3,2
rs.addnew
rs("housetype")=type_name
rs.update
Response.Write("<script>alert('类型添加成功!');window.location='edittype1.asp';</script>")
end if
elseif action="mdf" then '修改类型
type_name=request("typeedit")
if type_name="" then
Response.Write("<script>alert('类型不能为空,请填写!');window.location='edittype1.asp';</script>")
response.end
end if
set rs=db.execute("Select * from class_housetype Where housetype='"&type_name&"'")
if not rs.eof then
Response.Write("<script>alert('类型不能重复,请重填!');window.location='edittype1.asp';</script>")
response.end
else
set rs=server.createobject("adodb.recordset")
rs.open"select * from class_housetype where id=" &request("id"),db,1,3
rs("housetype")=request("typeedit")
rs.update
Response.Write("<script>alert('类型修改成功!');window.location='edittype1.asp';</script>")
end if
elseif action="del" then '删除类型
sql="delete from class_housetype where id=" &request("id")
set rs=db.execute(sql)
Response.Write("<script>alert('类型删除成功!');window.location='edittype1.asp';</script>")
end if
%>
</body>
<head>
<title>类型管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<br>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="200" valign="top">
<% if request("action")="modify" then
set rs=server.createobject("adodb.recordset")
sql="select * from class_housetype where id=" &request("id")
rs.open sql,db,1,3
%>
<FORM name=modifyform method=post action=?action=mdf&id=<%=request("id")%> >
<table width="278" border="0" align=center cellpadding="1" cellspacing="2">
<tr align="center" class="xiangxi">
<td height="30"><strong>修改房型</strong></td>
</tr>
<tr align="center">
<td height="25" class="font10" > 类型名称:
<input name="typeedit" class="input" id="typeedit" value="<%=rs("housetype")%>" size=24> </td>
</tr>
<tr align="center">
<td height="25" class="font10"><input type=submit value=修改 name="submit2">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</table>
</form>
<%end if%>
<form name="form1" method="post" action="?action=add">
<table width="278" border="0" align="center" cellpadding="0" cellspacing="1">
<tr align="center" class="xiangxi">
<td height="30"><strong>添加新的房屋类型</strong></td>
</tr>
<tr align="center">
<td height="25" class="bordbg"> 类型名称:
<input name="type_name" type="text" class="input" id="type_name" size="24"> </td>
</tr>
<tr align="center">
<td height="25" class="bordbg"><input name="Submit" type="submit" value="添加">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</table>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from class_housetype order by id DESC"
rs.open sql,db,1,1
%>
<br> <table width="278" border="0" align="center" cellpadding="0" cellspacing="1">
<tr align="center">
<td width="30" height="30" class="fenlei"><strong>序号</strong></td>
<td height="30" class="fenlei"><strong>名称</strong></td>
<td width="40" height="30" class="fenlei"><strong>编辑</strong></td>
<td width="40" height="30" class="fenlei"><strong>删除</strong></td>
</tr>
<%do while not rs.eof%>
<tr align="center">
<td height="25" class="bordbg"><%=rs("id")%> </td>
<td height="25" class="bordbg"><%=rs("housetype")%></td>
<td height="25" class="bordbg"><a href="?action=modify&id=<%=rs("id")%>">修改</a></td>
<td height="25" class="bordbg"><a href="?action=del&id=<%=rs("id")%>" onClick="javascript:return confirm('确实要删除吗?')">删除</a> </td>
</tr>
<% rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
</form></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -