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

📄 addhw.asp

📁 自己开发的一个网站数据库系统,希望和大家一块交流学习
💻 ASP
字号:
<%
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 rel="stylesheet" href="css.css" type="text/css">
</head>
<%
   set rs1=server.createobject("adodb.recordset")
   Sql="select * from sort"
   Rs.open Sql,conn,1,1
	Do while not Rs.eof
			sort_Name=Rs("sort_Name")
			sort_id=Rs("sort_id")
			Sql1="select * from sort2 where sort_id='"&sort_id&"'"
			Rs1.open Sql1,conn,1,1
			Do while not Rs1.eof
				i=i+1
				sort2_id=Rs1("sort2_id")
				sort2_Name=Rs1("sort2_name")
                    if request("Class_Nclass")=sort_id&","&sort2_id then
					k=" selected"
				else
					k=""
				end if
				Class_Type=Class_Type&"<option "&k&" value="&sort_id&","&sort2_id&">"&sort_Name&"──→"&sort2_Name&"</option>"
			Rs1.movenext
			loop
			Rs1.close
		Rs.movenext
		loop
		Rs.close
if request("Class_Nclass")<>"" then
Class_array=split(request("Class_Nclass"),",")
sql="select * from Sort3 where sort_Id='"&Class_array(0)&"' and sort2_Id='"&Class_array(1)&"'"
rs.open sql,conn,1,1
	do while not rs.eof 
		if request("Sort3_Id")=rs("Sort3_Id") then
			k=" selected"
		else
			k=""
		end if
		Singer_Type=Singer_Type&"<option"&k&" value="&rs("Sort3_Id")&">"&rs("Sort3_Name")&"</option>"
	rs.movenext
	loop
rs.close
end if
%>
  


<%
if request("action")="save" then
if instr(Request("Class_Nclass"),",")>0 then
	Class_array=split(Request.Form("Class_Nclass"),",")
	sort_Id=Class_array(0)
	sort2_Id=Class_array(1)
    else
	response.write "请选择所属类别"

    end if
    hw_name=request("hw_name")
    leibie=request("leibie")
    hw_cash=request("hw_cash")
    hw_pic=request("hw_pic")
    sort3_id=request("sort3_id")
ISBN=request("ISBN")
xing=request("xing")
ping=request("ping")
lei=request("lei")
zuoze=request("zuoze")
hwsn=request("hwsn")
hw_oldcash=request("hw_oldcash")
tejia=request("tejia")
hw_content=request.form("hw_content")
    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 hw_cash="" then
        errmsg=errmsg+"<br>"+"<li>商品价格不能为空"
        founderr=true
    end if
   
    if hw_pic="" then hw_pic="img/no.jpg"
    
    if founderr=true then
        response.write errmsg
        response.write "<br>"
        response.write "<a href=addhw.asp>返回</a>"
        response.end
    else
       

        hw_pic=server.htmlencode(hw_pic)    
        
        sql="select * from hw"
        rs.open sql,conn,3,3
        rs.addnew
        rs("hw_name")=hw_name
        rs("xing")=xing
        rs("ping")=ping
        rs("lei")=lei
        rs("leibie")=leibie
       if tejia="on" then   
       rs("tejia")=true
      else 
      rs("tejia")=false
      end if
        rs("hw_content")=hw_content
        rs("hw_cash")=hw_cash
        rs("sort_id")=sort_id
        rs("sort2_id")=sort2_id
if sort3_id<>"all" then 
        rs("sort3_id")=sort3_id
end if
rs("zuoze")=zuoze
rs("hw_oldcash")=hw_oldcash
       rs("hw_sn")=hwsn
       rs("ISBN")=ISBN
        rs("hw_pic")=hw_pic
        rs.update
    end if
    response.write "货物添加成功"
    response.write "<p>"%>
    <%response.write "<br>"
    response.write "<a href=addhw.asp>返回</a>"
    rs.close
    

else
%>

<table border="0" width="100%" cellspacing="1">
  <tr>
    <td width="100%">
      <form method="POST" action="addhw.asp?action=save"  name="myform">

          <table width="98%" border="1" bordercolordark=#9CC7EF bordercolorlight=#145AA0 cellspacing="0" cellpadding="4" align="center">
    <tr> 
      <td  bgcolor="#4296E7" colspan=2> 
        <div align="center"><font color="#FFFFFF">添加商品[如果不添则浏览时不显示]</font></div>
      </td>
    </tr>
          <tr> 
            <td width="20%">商品基本类别</td><td width=80%> 
             <select name="Class_Nclass" size="1" onChange="window.open('addhw.asp?Class_Nclass='+this.options[this.selectedIndex].value,'_self')">
                <option value="">请选择分类</option>
                <%=Class_Type%> 
              </select><font color=red>*必须</font>
            </td>
          </tr>
          <tr> 
            <td width="20%">商品第三类别</td><td width=80%>  
            <select name="Sort3_id" size="1">
              <option value="all">请选择第三类别 </option>
              <%=Singer_Type%> 
            </select>
            </td>
          </tr>
                    <tr> 
            <td width="20%">规格属性</td><td width=80%>   
             <select name="leibie" size="1">
                <option value="作者">书籍</option>
                <option  value="演唱">磁带</option>
<option  value="演唱">CD</option><option  value="主演">影视</option> 
              </select>
            </td>
          </tr>
          <tr> 
            <td width="20%">商品名</td><td width=80%>  
              <input type="text" name="hw_name" size="20" class=input maxlength=20><font color=red>*必须(最长20个字)</font>
            </td>
          </tr>
          
          <tr> 
            <td width="20%">厂商</td><td width=80%>  
              <input type="text" name="lei" size="20" class=input maxlength=20>(非必需,最长20个字)
            </td>
          </tr>
          <tr> 
            <td width="20%">生产日期</td><td width=80%>  
              <input type="text" name="xing" size="20" class=input maxlength=20>(非必需,最长20个字)
            </td>
          </tr>
          <tr> 
            <td width="20%"> 商品原价</td><td width=80%>  
              <input type="text" name="hw_oldcash" size="20" class=input maxlength=10>
              <font color="#FF0000">支持小数</font><font color=red>*必须</font> </td>
          </tr>

          <tr> 
            <td width="20%"> 商品现价</td><td width=80%>  
<input type="text" name="hw_cash" size="20" class=input  maxlength=10>              
<font color="#FF0000">支持小数</font><font color=red>*必须</font> </td>
          </tr>
          <tr> 
            <td width="20%">是否特价</td><td width=80%>  
              <input type="checkbox" name="tejia"> 特价商品
            </td>
          </tr>

          <tr> 
            <td width="100%" colspan=2>商品介绍</td>
          </tr>
          <tr> 
            <td width="100%" colspan=2> 
              <textarea rows="9" name="hw_content" cols="77" class=input>暂时没有……</textarea><font color=red>*必须</font>
            </td>
          </tr>
          <tr> 
            <td width="100%" colspan=2>商品图片 <input type="text" name="hw_pic" size="75" class=input  maxlength=100>
            </td>
          </tr>


        </table>
        <p><input type="submit" value="提交" name="B1" class=input><input type="reset" value="全部重写" name="B2" class=input></p>
      </form>
        </td>
  </tr>
</table>

<%
end if
set rs=nothing
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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