我的网页修改和添加功能实现不了,代码如下:
<!--#include file="../conn.asp" -->
<!--#include file="../inc/function.asp"-->
<%if session("china_admin")="" then response.redirect "login.asp"
dim action,id,d_name,Rs,Sql,i
id=strint(request.QueryString("id"))
action=HtmlEncode(request.querystring("action"))
d_name=HtmlEncode(request("name"))
dbpath="../"
dblink
select case action
case "add"
set Rs=server.CreateObject("adodb.recordset")
Rs.open "select name from news_type",conn,1,3
Rs.AddNew
Rs(0)=d_name
Rs.Update
Rs.Close:set Rs=nothing
case "edit"
set Rs=server.CreateObject("adodb.recordset")
Rs.open "select name from news_type where id="&id,conn,1,3
Rs(0)=d_name
Rs.Update
Rs.Close:set Rs=nothing
case "del"
conn.execute ("delete from news_type where id="&id)
end select
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>分类管理</title>
</head>
<body background="images/background.gif">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
<tr>
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" >新 闻 分 类 栏 目 管 理</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> 首页 <br />
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
<tr align="center" bgcolor="#FFFFFF" height="20">
<td width="30">编号</td>
<td>分类名称</td>
<td>管理操作</td>
</tr>
<%set Rs=server.CreateObject("adodb.recordset")
Rs.Open "select name,id from news_type ",conn,1,1
dim follows
if Rs.EOF and Rs.BOF then
response.write"<tr bgcolor=#FFFFFF><td colspan='4'><p align='center'><font color='red'>错误</font></td></tr></table><br>"
follows=0
else
do while not Rs.EOF
i=i+1%>
<FORM name="form1" method="post" action="?action=edit&id=<%=int(Rs("id"))%>">
<tr bgcolor="#FFFFFF" align="center">
<td><%=i%></td>
<td><input name="d_name" type="text" id="d_name" value="<%=trim(Rs(0))%>" size="12" /></td>
<td><input type="submit" name="Submit2" value="修 改" />
<input type="button" name="DEL" onClick="{if(confirm('确定要删除这个分类吗?\n将删除此分类下所有信息\n此操作不可以恢复!')){location.href='?id=<%=Rs("id")%>&action=del';}return false;}" value="删除"></td>
</tr>
</form>
<%Rs.MoveNext
loop
follows=Rs.RecordCount
end if
conn.close:Set conn=nothing%>
</table>
<br /></td>
</tr>
</table>
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
<tr>
<td height="20" bgcolor="#799AE1" align="center"><font color="#FFFFFF" >添 加 新 闻 分 类 名 称</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<br />
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D6DFF7">
<tr align="center" bgcolor="#FFFFFF" height="20">
<td width="30">编号 </td>
<td>分类名称</td>
<td>确定操作</td>
</tr>
<form name="form1" method="post" action="?action=add">
<tr align="center" bgcolor="#FFFFFF">
<td><%=follows+1%></td>
<td><input name="d_name" type="text" id="d_name" size="12" /></td>
<td><input type="submit" name="Submit3" value="添 加" /></td>
</tr>
</form>
</table>
<br /></td>
</tr>
</table>
</body>
</html>