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

📄 addhw.asp

📁 自做的购物网站
💻 ASP
字号:
<%
if session("admin_name")="" then response.end
set rs=server.createobject("adodb.recordset")%>

<!--#include file="conn.asp"-->
<!--#include file="css.asp"-->
<%
if request("action")="save" then
    hw_name=request("hw_name")
    hw_content=request("hw_content")
    hw_cash=request("hw_cash")
	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")
hw_pic=request("hw_pic")
    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 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>")        
        
        if hw_pic="" then
		hw_pic="images/noimage.gif"
		end if
		
        dim hw_id
        sql="select * from hw"
        rs.open sql,conn,3,3
        rs.addnew
		hw_id=rs("hw_id")
        rs("hw_name")=hw_name
        rs("hw_content")=hw_content
        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("tuijian")=tuijian
		rs("hw_pic")=hw_pic
        rs.update
	    end if	
		hw_id=rs("hw_id")
	rs.close
	%>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td>
      <div align="center">
        <p>货物添加成功,请上传图片</p>
        <p>&nbsp;</p>
      </div>
	  
    </td>
  </tr>
  <tr> 
    <td><form name="form1" method="post" action="upfile.asp?hw_id=<%=hw_id%>" enctype="multipart/form-data" >
  <input type="hidden" name="act" value="upload">
  <input type="hidden" name="upcount" value="1">
   
  
        <table width="500" border="1" cellspacing="0" cellpadding="5" align="center" bordercolordark="#CCCCCC" bordercolorlight="#000000">
          <tr bgcolor="#CCCCCC"> 
            <td height="22" align="left" valign="middle" bgcolor="#CCCCCC" colspan="2">&nbsp;&nbsp;&nbsp; 
            </td>
          </tr>
          <tr align="center" valign="middle" bgcolor="#eeeeee"> 
            <td align="left" id="upid" height="15" bgcolor="#eeeeee" colspan="2"> 
              商品图片: 
              <input type="file" name="file1" style="width:400" class="tx1" value="" size="20">
            </td>
          </tr>
          <tr align="center" valign="middle" bgcolor="#cccccc"> 
            <td bgcolor="#cccccc" height="2"> 
              <input type="submit" value="上传" name="B1" class="txt " IsShowProcessBar="True">
            </td>
            <td bgcolor="#cccccc" height="2"><a href=addhw.asp>返回</a></td>
          </tr>
        </table>
</form></td>
  </tr>
</table>
<br>
<%
   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.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>


<body>
<form method="POST" name="myform" action="addhw.asp?action=save">
  <TABLE cellSpacing=1 cellPadding=0 width="550" align=center bgColor=#999999 
border=0>
    <TBODY> 
    <TR> 
      <TD width="735" background=images/pics/tile_back.gif id=maintitleback> <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
          <TBODY>
            <TR> 
              <TD><IMG height=8 src="images/pics/nav_m.gif" width=8 
            border=0></TD>
                <TD width="100%" height="30" valign="bottom" id=maintitle>商品管理 -&gt;<b>所有选项都必须填写</b></TD>
            </TR>
          </TBODY>
        </TABLE></TD>
    </TR>
    <TR> 
      <TD id=mainbg> 
	  
	    <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0 height="435">
          <TBODY> 
          <TR> 
            <TD height="30" noWrap 
          background=images/pics/tile_sub.gif id=titlemedium> 
              <div align="center"><font color="#FFFFFF">商品分类</font></div>
            </TD>
            <TD height="30" colspan="2" noWrap 
          background=images/pics/tile_sub.gif id=titlemedium> 
              <div align="center"> 
                <%
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%>
                </select>
              </div>
            </TD>
            <TD height="30" align=middle noWrap 
          background=images/pics/tile_sub.gif id=titlemedium> 
              <div align="center"><font color="#FFFFFF">商品名称</font></div>
            </TD>
            <TD height="30" colspan="2" align=middle noWrap 
          background=images/pics/tile_sub.gif id=titlemedium>  
              <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="hw_name" size="20" class=input>
            </TD>
          </TR>
          <TR> 
            <TD bgColor=#ffffff height="30"> 
              <div align="center"><font color="#FF0000">商品原价</font></div>
            </TD>
            <TD width=122 height="30" align=middle bgColor=#ffffff> 
              <div align="center"><font color=#333333> 
                <input style="FONT-SIZE: 12px; WIDTH: 60px" name="pifa" type="text" class=input id="pifa5" size="7">
                元</font></div>
            </TD>
            <TD width=122 height="30" align=middle bgColor=#ffffff> 
              <div align="center"><font color="#FF0000">会员价格</font></div>
            </TD>
            <TD width=122 height="30" align=middle bgColor=#ffffff> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 60px" name="hw_cash" type="text" class=input id="hw_cash5" size="7">
                元 <font color="#FF0000">&nbsp;</font></div>
            </TD>
            <TD width=122 height="30" bgColor=#ffffff> 
              <div align="center"><font color="#FF0000">VIP价格</font></div>
            </TD>
            <TD width=122 height="30" align=middle bgColor=#ffffff> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 60px" name="daili" type="text" class=input id="daili5" size="7">
                元</div>
            </TD>
          </TR>
          <TR> 
            <TD height="30" colspan="6" bgColor=#ffffff> 
              <div align="center"><img src="../IMAGES/pics/seperator.gif" width="359" height="1"></div>
            </TD>
          </TR>
          <TR> 
            <TD bgColor=#ffffff height="30"> 
              <div align="center">录入</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="hwsn" size="10" class=input value="不详">
              </div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center">出品公司</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="chubsh" size="12" class=input value="不详">
              </div>
            </TD>
            <TD bgColor=#ffffff height="30"> 
              <div align="center">尺码</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="kaiben" size="9" class=input value="16">
              </div>
            </TD>
          </TR>
          <TR> 
            <TD bgColor=#ffffff height="30"> 
              <div align="center">出品日期</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="data" size="12" class=input value="2002-10-10">
              </div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center">编号</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="isbn" size="12" class=input value="不详">
              </div>
            </TD>
            <TD bgColor=#ffffff height="30"> 
              <div align="center">颜色</div>
            </TD>
            <TD align=middle bgColor=#ffffff height="30"> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="yeshu" size="9" class=input value="100">
              </div>
            </TD>
          </TR>
          <TR> 
            <TD bgColor=#ffffff height="30"> 
              <div align="center">包装类型 </div>
            </TD>
            <TD height="30" align=middle bgColor=#ffffff> 
              <div align="center"> 
                <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="zhuang" size="12" class=input value="普通">
              </div>
            </TD>
            <TD height="30" align=middle bgColor=#ffffff>&nbsp;</TD>
            <TD height="30" align=middle bgColor=#ffffff>&nbsp;</TD>
            <TD height="30" align=middle bgColor=#ffffff>&nbsp;</TD>
            <TD height="30" align=middle bgColor=#ffffff>&nbsp;</TD>
          </TR>
          <TR> 
            <TD height="30" colspan="6" bgColor=#ffffff> 
              <div align="center"><img src="../IMAGES/pics/seperator.gif" width="359" height="1"></div>
            </TD>
          </TR>
          <TR> 
            <TD bgColor=#ffffff height="30"> 
              <div align="center"><font color="#FF0000">内容简介</font></div>
            </TD>
            <TD height="30" colspan="5" align=middle bgColor=#ffffff> 
              <div align="left"> 
                <textarea rows="3" name="hw_content" cols="50" class=input>暂时没有商品介绍……</textarea>
              </div>
            </TD>
          </TR>
          <TR> 
            <TD height="30" colspan="6" bgColor=#ffffff> 
              <div align="center"><img src="../IMAGES/pics/seperator.gif" width="359" height="1"></div>
            </TD>
          </TR>
          <TR> 
            <TD height="30" colspan="6" bgColor=#ffffff> 
              <div align="center">推荐此商品 
                <input type="radio" name="tuijian" value="-1">
                不推荐 
                <input type="radio" name="tuijian" value="0" checked>
              </div>
            </TD>
          </TR>
          <TR> 
            <TD height="30" colspan="6" bgColor=#ffffff> 
              <div align="center"></div>
            </TD>
          </TR>
          <TR> 
            <TD id=mainfoot 
colSpan=6 height="30"> 
              <div align="center"> 
                <table width="30%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                    <td height="25"> 
                      <div align="center"> 
                        <input name=submit2 type=image 
      src="../IMAGES/pics2/s_button000.gif" alt=进入 
      align=absMiddle width="45" height="20" cache tppabs="">
                      </div>
                    </td>
                    <td> 
                      <div align="center"> 
                        <input type="reset" value="全部重写" name="B22" class=input>
                      </div>
                    </td>
                  </tr>
                </table>
              </div>
            </TD>
          </TR>
          </TBODY> 
        </TABLE>
		
		</TD>
    </TR>
  </TBODY>
</TABLE></form>	  
</body>
</html>

<%end if%>

⌨️ 快捷键说明

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