char.inc代码是
<%
Function htmlencode2(strer)
If not isNull(strer) and strer <> "" Then
strer=replace(strer,"<","<"
strer=replace(strer,">",">"
strer=replace(strer," "," "
strer=Replace(strer, "'", """
strer=Replace(strer, """", """
strer=replace(strer,vbCrLf,"<br>"
End If
htmlencode2=strer
End Function
%>
下面这段代码会不会出有错误:问题是不是出在红色部分
<!--#include file="char.inc"-->
<%
if session("admin_name"
="" then response.end
set rs=server.createobject("adodb.recordset"
%>
<!--#include file="conn.asp"--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=../css.css rel=STYLESHEET type=text/css>
</head>
<%
if request("action"
="save" then
hw_name=request("hw_name"
hw_content=htmlencode2(request("hw_content"
)
hw_content2=htmlencode2(request("hw_content2"
)
hw_cash=request("hw_cash"
hw_pic=request("hw_pic"
chubsh=request("chubsh"
zhuang=request("zhuang"
yeshu=request("yeshu"
isbn=request("isbn"
sort_id=request("sort_id"
Nsort_id=request("Nsort_id"
company=request("company"
pifa=request("pifa"
daili=request("daili"
hwsn=request("hwsn"
data=request("data"
kaiben=request("kaiben"
tuijian=request("tuijian"
jia=request("jia"
if not(isnumeric(hw_cash)) then
errmsg="<br>"+"<li>价格应该为数字"
founderr=true
end if
if hw_name="" then
errmsg=errmsg+"<br>"+"<li>名称不能为空"
founderr=true
end if
if hw_content="" then
errmsg=errmsg+"<Br>"+"<li>介绍不能为空"
founderr=true
end if
if sort_id="" then
errmsg=errmsg+"<br>"+"<li>类别不能为空"
founderr=true
end if
if nsort_id="" then
errmsg=errmsg+"<br>"+"<li>类别不能为空"
founderr=true
end if
if hw_pic="" then hw_pic="img/noimage.gif"
if founderr=true then
response.write errmsg
response.write "<br>"
response.write "<a href=addhw.asp>返回</a>"
response.end
else
hw_name=server.htmlencode(hw_name)
hw_name=replace(hw_name," "," "
hw_name=replace(hw_name,chr(13)&chr(10),"<Br>"
hw_content=server.htmlencode(hw_content)
hw_content=replace(hw_content," "," "
hw_content=replace(hw_content,chr(13)&chr(10),"<Br>"
hw_pic=server.htmlencode(hw_pic) sql="select * from hw"
rs.open sql,conn,3,3
rs.addnew
rs("hw_name"
=hw_name
rs("hw_content"
=hw_content
rs("hw_content2"
=hw_content2
rs("hw_cash"
=hw_cash
rs("sort_id"
=sort_id
rs("Nsort_id"
=Nsort_id
rs("company"
=company
rs("daili"
=daili
rs("pifa"
=pifa
rs("hw_sn"
=hwsn
rs("chubsh"
=chubsh
rs("kaiben"
=kaiben
rs("yeshu"
=yeshu
rs("data"
=data
rs("isbn"
=isbn
rs("zhuang"
=zhuang
rs("hw_pic"
=hw_pic
rs("tuijian"
=tuijian
rs("jia"
=jia
rs.update
end if
response.write "货物添加成功"
response.write "<br>"
response.write "<a href=addhw.asp>返回</a>"
rs.close
else
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<title>添 加 商 品</title>
<link rel="stylesheet" type="text/css" href="style.css">
<%
dim count
set rs=server.createobject("adodb.recordset"
sql = "select * from Nsort order by Nsort_id asc"
rs.open sql,conn,1,1
%>
<script language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("Nsort_name"
)%>","<%= trim(rs("sort_id"
)%>","<%= trim(rs("Nsort_id"
)%>"
;
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Nsort_id.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nsort_id.options[document.myform.Nsort_id.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
</head>
<body>
<tr>
<td>
<div align="center"><b>所有选项都必须填写</b></div>
</td>
</tr>
<form method="POST" name="myform" action="addhw.asp?action=save">
<table class="border" cellspacing="0" width="80%" border="0" cellpadding="4" cellspacing="0" >
<tr align="center">
<td class="tdbg" width="100%">
<table border="0" cellspacing="1" width="100%">
<td width="85%">
<%
sql = "select * from sort"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else%>
<select name="sort_id" onChange="changelocation(document.myform.sort_id.options[document.myform.sort_id.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("sort_id"
)%>"><%=trim(rs("sort_name"
)%></option>
<% dim selclass
selclass=rs("sort_id"
rs.movenext
do while not rs.eof
%> <option value="<%=trim(rs("sort_id"
)%>"><%=trim(rs("sort_name"
)%></option>
<%rs.movenext
loop
end if
rs.close
%></select>
<select name="Nsort_id">
<%sql="select * from Nsort where sort_id="&selclass
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("Nsort_ID"
%>"><%=rs("Nsort_name"
%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("Nsort_ID"
%>"><%=rs("Nsort_name"
%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing%>
</td>
</tr>
</table>
<table border="0" width="500" cellspacing="1" height="392" align="left">
<tr>
<td width="100%" height="395">
<table border="0" width="100%" cellspacing="1">
<tr>
<td colspan="2"><font color="#FF0000">型号名称</font>
<input type="text" name="hw_name" size="20" class=input>
<font color="#FF0000"> </font> </td>
</tr>
<tr>
<td colspan="2"><font color="#FF0000">市场价</font>
<input type="text" name="pifa" size="7" class=input>
元 <font color="#FF0000"> 会员价</font>
<input type="text" name="hw_cash" size="7" class=input>
元 <font color="#FF0000"> VIP价</font>
<input type="text" name="daili" size="7" class=input>
元 </td>
</tr>
<tr>
<td height="5" colspan="2">
<hr noshade size="1">
</td>
</tr>
<tr>
<td><font color="#000000">录入</font>
<input type="text" name="hwsn" size="10" class=input value="不详">
</td>
<td width="63%"><font color="#000000">出品公司</font>
<input type="text" name="chubsh" size="30" class=input value="不详">
</td>
</tr>
<tr>
<td><font color="#000000">尺码</font>
<input type="text" name="kaiben" size="10" class=input value="16">
</td>
<td width="63%"><font color="#000000">出品日期</font>
<input type="text" name="data" size="24" class=input value="2002-10-10">
格式:2002-10-10</td>
</tr>
<tr>
<td><font color="#000000">颜色</font>
<input type="text" name="yeshu" size="10" class=input value="100">
</td>
<td width="63%"><font color="#000000">编号</font>
<input type="text" name="isbn" size="30" class=input value="不详">
</td>
</tr>
<tr>
<td height="5" colspan="2">
<hr noshade size="1">
</td>
</tr>
<tr>
<td colspan="2"> <font color="#000000">包装类型</font>
<input type="text" name="zhuang" size="30" class=input value="普通">
</td>
</tr>
<tr>
<td colspan="2"> <font color="#FF0000">简单内容介绍</font></td>
</tr>
<tr>
<td valign="top" colspan="2">
<textarea rows="3" name="hw_content" cols="50" class=input>暂时没有……</textarea>
</td>
</tr>
<tr>
<td valign="top" colspan="2"><font color="#FF0000">详细内容介绍</font></td>
</tr>
<tr>
<td valign="top" colspan="2">
<textarea rows="10" name="hw_content2" cols="50" class=input>暂时没有……</textarea>
</td>
</tr>
<tr>
<td colspan="2"> <font color="#FF0000">商品图片</font>
<input type="text" name="hw_pic" size="46" class=input value="pic/">
<a href="upfile.asp" target="_blank">上传图片</a></td>
</tr>
</table>
<table width="372" border="0" cellspacing="0" cellpadding="0" height="24">
<tr>
<td>推荐此商品
<input type="radio" name="tuijian" value="-1">
不推荐
<input type="radio" name="tuijian" value="0" checked>
<br>
否特价
<input name="jia" type="radio" value="0" checked>
是特价
<input type="radio" name="jia" value="1">
</td>
</tr>
</table>
<input type="hidden" name="act" value="upload">
<input type="hidden" name="upcount" value="1">
<p>
<input type="submit" value="提交" name="B1" class=input>
<input type="reset" value="全部重写" name="B2" class=input>
</p>
</td>
</tr>
</table>
</form>
</body>
</html>
<%end if%>