<!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<!--#include file="../inc/function.asp"-->
<link href="inc_style.css" rel="stylesheet" type="text/css">

<%
if request("sj")="add" then
dim rs,sql,sjcla1,sjcla2,paixu
jle=request("jle")
sjcla1=request("sjcla1")
sjcla2=HtmlEncode(trim(request("sjcla2")))
paixu=trim(request("paixu"))

if jle="hotx" or  jle="hoty"  then
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from sjcla2 where id="&sjcla2&""
rs.open sql,conn,1,3
if jle="hotx" then
rs("hot")=0
else
rs("hot")=1
end if
rs.update
rs.close
response.write "<script language=javascript>alert('设置成功！'); window.close();</script>"
end if


if sjcla1="" then
response.write "<li>错误，类别为空！"
response.write "<meta http-equiv=refresh content=""2;URL=admin_shop_categories.asp"">"
response.end
end if
if sjcla2="" then
response.write "<li>错误，类别为空！"
response.write "<meta http-equiv=refresh content=""2;URL=admin_shop_categories.asp"">"
response.end
end if
if paixu="" then
response.write "<li>错误，类别为空！"
response.write "<meta http-equiv=refresh content=""2;URL=admin_shop_categories.asp"">"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [sjcla2] where sjcla2='"&sjcla2&"' order by paixu desc" 
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("sjcla1")=sjcla1
rs("sjcla2")=sjcla2
rs("paixu")=paixu
rs.update
response.write "类别添加成功！！<br>"
response.write "<a href=""?id="&request("id")&""">继续添加</a>"
else
response.write "类别已经存在，请确认你的输入是正确的！"
response.write "<meta http-equiv=refresh content=""2;URL=admin_shop_categories.asp"">"
response.end
end if
rs.close
set rs=nothing
end if
%>

<div align="center">
  <center>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#cac8c9" width="400" height="68">
    <form action="?id=<%=request("id")%>&sj=add" name="jle" method="POST">
    <tr>
    <td height="25" bgcolor="#A7D0F5">
    <p align="center">添加二级分类</td>
    </tr>
    <tr>
    <td height="25" style="border-bottom-style: none; border-bottom-width: medium">
    <p align="center">所属大类：
<select name="sjcla1" size="1" style="font-size: 9pt">
<%
id=request("id")
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [sjcla1] order by paixu desc" 
rs.open sql,conn,1,1
if rs.eof then
response.write "没有类别请添加！"
response.end
else
Do while not rs.eof
   if id=cstr(rs("id")) then
      jle="selected"
   else
      jle=""
   end if
   response.write "<option " & jle & " value=" +  Cstr(rs("id")) + ">" + rs("sjcla1") + "</option>"
   rs.MoveNext
Loop
end if
rs.close
set rs=nothing
closedb
%>
      </select>
    </td>
    </tr>
    <tr>
      <td height="25" align="center" style="border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium">

<p>分类名称：<input type="text" name="sjcla2" size="19" value=""></p>

      </td>
    </tr>
    <tr>
      <td height="25" align="center" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium">
<p>排序数字：<input type="text" name="paixu" size="19" value="0"></td>
    </tr>
    <tr>
      <td width="322" height="25" style="border-top-style: none; border-top-width: medium">
<p align="center"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<input type="submit" value="提交" name="B1"></td>
    </tr>
    </form>
  </table>
  </center>
</div>