⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addhw.asp

📁 网络购物
💻 ASP
字号:
<%'=========================================''         凡人网络购物系统V4.0免费版'    FreeDown.Net info@freedown.net '            www.freedown.net'     版权所有·免费版仅供研究测试只用'            商业使用请购买正版''=========================================%>
<%
function htmlencode2(str)
    dim result
    dim l
    if isNULL(str) then 
       htmlencode2=""
       exit function
    end if
    l=len(str)
    result=""
	dim i
	for i = 1 to l
	    select case mid(str,i,1)
	           case "<"
	                result=result+"&lt;"
	           case ">"
	                result=result+"&gt;"
              case chr(13)
	                result=result+"<br>"
	           case chr(34)
	                result=result+"&quot;"
	           case "&"
	                result=result+"&amp;"
              case chr(32)	           
	                'result=result+"&nbsp;"
	                if i+1<=l and i-1>0 then
	                   if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9)  then	                      
	                      result=result+"&nbsp;"
	                   else
	                      result=result+" "
	                   end if
	                else
	                   result=result+"&nbsp;"	                    
	                end if
	           case chr(9)
	                result=result+"    "
	           case else
	                result=result+mid(str,i,1)
         end select
       next 
       htmlencode2=result
   end function
%>

<%
if session("admin_name")="" then
    response.redirect "login.asp"
end if
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," ","&nbsp;")
        hw_name=replace(hw_name,chr(13)&chr(10),"<Br>")
        
        
        hw_content=server.htmlencode(hw_content)
        hw_content=replace(hw_content," ","&nbsp;")
        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 5.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.form.Nsort_id.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.form.Nsort_id.options[document.form.Nsort_id.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>
</head>

<body>
<tr>
    <td>
      <div align="center"><b>所有选项都必须填写</b></div>
    </td>
  </tr>


  <table  cellspacing="0" width="80%" border="0" cellpadding="4" cellspacing="0" >
   <form method="POST" name="form" action="addhw.asp?action=save"> 
    <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.form.sort_id.options[document.form.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"> &nbsp;&nbsp;&nbsp;&nbsp; </font> </td>
              </tr>
              <tr> 
                <td colspan="2"><font color="#FF0000">市场价</font> 
                  <input type="text" name="pifa" size="7" class=input>
                  元 <font color="#FF0000">&nbsp;&nbsp;&nbsp;会员价</font> 
                  <input type="text" name="hw_cash" size="7" class=input>
                  元 <font color="#FF0000">&nbsp;&nbsp;&nbsp;&nbsp;VIP价</font> 
                  <input type="text" name="daili" size="7" class=input>
                  元 </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="中">
                </td>
                <td width="63%"><font color="#000000">出品日期</font> 
                  <input type="text" name="data" size="24" class=input value="2004-04-10">
                  格式:2002-10-10</td>
              </tr>
              <tr> 
                <td><font color="#000000">商品颜色</font> 
                  <input type="text" name="yeshu" size="10" class=input value="金属色">
                </td>
                <td width="63%"><font color="#000000">商品编号</font> 
                  <input type="text" name="isbn" size="30" class=input value="2004">
                </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="80" 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="8" name="hw_content2" cols="80" class=input>暂时没有……</textarea>
                </td>
              </tr>
              <tr> 
                <td colspan="2"> <font color="#FF0000">商品图片</font> 
                  <input type="text" name="hw_pic" size="46" class=input>
                </td>
              </tr>
              <tr> 
                <td colspan="2"><IFRAME src="../upfile.asp" frameBorder=0 width="100%" height="30" scrolling=no height=21></IFRAME></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>
                  &nbsp;&nbsp; 是
                  <input type="radio" name="jia" value="1"> 
                </td>
              </tr>
            </table>
            <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%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -