<head>
<title>修 改</title>
<STYLE type=text/css>
A:link {COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:visited {	COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:active { COLOR: #ff0000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: none}
BODY {FONT-SIZE: 9pt}
TH {FONT-SIZE: 9pt}
TD {FONT-SIZE: 9pt}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function check()
{
	if(form1.name.value.length<1)	
	{
		alert("商品名称不能为空") ;
		return false;
	}
	if(form1.html.value.length<1)	
	{
		alert("商品代码不能为空") ;
		return false;
	}
	if(form1.facies.value.length<1)	
	{
		alert("效果图路径不能为空") ;
		return false;
	}
	var i=form1.price.value
	if(isNaN(i)!=false||(i="")||(form1.price.value.length<1))
	{
		alert("价格必须为数字！") ;
		return false;
	}

	var i=form1.level.value
	if(isNaN(i)!=false||(i="")||(form1.level.value.length<1))
	{
		alert("级别必须为数字！") ;
		return false;
	}

	var i=form1.quantity.value
	if(isNaN(i)!=false||(i="")||(form1.quantity.value.length<1))
	{
		alert("存货数量必须为数字！") ;
		return false;
	}

	
	
	return true;
}
</script>


</head>

<body bgcolor="#396BA5">

<!--#include file="conn.asp"-->
<%if session("admin")="administrator" then
		IF request.form("bz")="" then 
			id=request.querystring("id")
			id=replace(id,"'","")
			id=replace(id,"""","")
			if Len(id) > 10 then	response.end
			if id="" then response.redirect("shop.asp") end if
			set rs = Server.CreateObject("ADODB.Recordset")
			rs.Open "Select * From Products where ID='"&ID&"'",conn,1,3
			if rs.eof then response.redirect("shop.asp?id="&session("idid")&"") end if
	%>
<form method="POST" name="form1" action="edit.asp" onsubmit="return check();">
<input type=hidden name=bz value="12345"> 
<div align="center">
  <center>

<table border="0" width="500" cellspacing="1" cellpadding="3" height="301">
  <tr>
    <td width="100%" colspan="2" bgcolor="#C6C6C6" height="27" style="border-style: ridge; border-width: 1">
      <p align="center">修 改 商 品 属 性</td> 
  </tr> 
  </center> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">商品名称:</td> 
    <center> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="name" size="25" value="<%=rs("ProductName")%>"></td> 
  </tr> 
  </center> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">商品代码:</td> 
    <center> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="html" size="50" value="<%=rs("ProductHtml")%>"></td> 
  </tr> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">效果图路径:</td> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="facies" size="50" value="<%=rs("Facies")%>"></td> 
  </tr> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">价格:</td> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="price" size="12" value="<%=rs("Price")%>"></td> 
  </tr> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">可使用的级别:</td> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="level" size="12" value="<%=rs("ProductLevel")%>"></td> 
  </tr> 
  </center> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">存货数量:</td> 
    <center> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="quantity" size="12" value="<%=rs("Quantity")%>"></td> 
  </tr> 
  </center> 
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">商品类型:</td> 
    <center> 
    <td width="58%" bgcolor="#F7F7F7" height="25">
	  <SELECT name="type">
 	<%for i=0 to zlmmx %>   
		<OPTION value=<% =zlm(i,1) %>><% =zlm(i,0) %></OPTION>
	<%next%>    
	</SELECT>
    </td> 
  </tr> 
  </center>
  <tr> 
    <td width="42%" bgcolor="#F7F7F7" height="25"> 
      <p align="right">商品简介:</td> 
    <center> 
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="memo" size="50" value="<%=rs("memo")%>"></td> 
  </tr> 
  <tr> 
    <td width="100%" colspan="2" bgcolor="#C0C0C0" height="27" style="border-style: ridge; border-width: 1"> 
    <input type=hidden name=bz value="12345">  
	<input type=hidden name=id value="<%=id%>">  
 
      <p align="center"><input type="submit" value="提  交" name="B1">    
    </td> 
  </tr> 
</table> 
  </center>
</div>
</form>    
<% 
			rs.close 
		else 
			id=request.form("ID")
			id=replace(id,"'","")
			id=replace(id,"""","")
			name=replace(request.form("name"),"'","")
			html=replace(request.form("html"),"'","") 
			facies=replace(request.form("facies"),"'","")
			price=request.form("price")
			level=request.form("level")
			quantity=request.form("quantity")
			type1=request.form("type")
			memo=replace(request.form("memo"),"'","")
			sql="UPDATE Products SET ProductName='"&name&"',ProductHtml='"&html&"',Facies='"&Facies&"',Price="&Price&",ProductLevel="&Level&",quantity="&quantity&",type="&type1&",memo='"&memo&"' WHERE ID="&ID 
			conn.execute sql 
			response.redirect("shop.asp?id="&session("idid")&"") 
		end if 
	else 
	response.redirect("shop.asp?id="&session("idid")&"") 
end if 
conn.close 
%>