changehw1.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:8k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <!--#include file="conn.asp"-->
  3. <%
  4.   if session("admin")="" then
  5.   response.redirect "admin.asp"
  6.   end if
  7. %><head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  9. <link href=../css.css rel=STYLESHEET type=text/css>
  10. </head>
  11. <%
  12. dim hw_id ,hw_name,hw_cash,hw_pic,hw_date,sort_id,hw_content,he_views,he_buys,chubsh,zhuang,hw_sn,company,yeshu,kaiben,isbn,pifa,daili,data
  13. set rs=server.createobject("adodb.recordset")
  14. sql="select * from hw where hw_id="&request("hw_id") 
  15. rs.open sql,conn,1,1
  16.       hw_id=rs("hw_id")
  17.       hw_name=rs("hw_name")
  18.       hw_cash=rs("hw_cash")
  19.       hw_pic=rs("hw_pic")
  20.       hw_date=rs("hw_date")
  21. hw_sn=rs("hw_sn")
  22.       sort_id=rs("sort_id")
  23.  Nsort_id=rs("Nsort_id")
  24.       hw_content=rs("hw_content")
  25.       hw_views=rs("hw_views")
  26.       hw_buys=rs("hw_buys")
  27.       chubsh=rs("chubsh")
  28.       zhuang=rs("zhuang")
  29.       hw_sn=rs("hw_sn")
  30.       company=rs("company")
  31.       yeshu=rs("yeshu")
  32.       kaiben=rs("kaiben")
  33.       isbn=rs("isbn")
  34. pifa=rs("pifa")
  35. daili=rs("daili")
  36. data=rs("data")
  37. rs.close
  38. %>
  39. <%
  40. if request("action")="save" then
  41.     hw_name=request("hw_name")
  42.     hw_content=request("hw_content")
  43.     hw_cash=request("hw_cash")
  44.     hw_pic=request("hw_pic")
  45. chubsh=request("chubsh")
  46. zhuang=request("zhuang")
  47. yeshu=request("yeshu")
  48. isbn=request("isbn")
  49.     sort_id=request("sort_id")
  50. Nsort_id=request("Nsort_id")
  51.     company=request("company")
  52.    pifa=request("pifa")
  53. daili=request("daili")
  54. hw_sn=request("hw_sn")
  55. data=request("data")
  56. kaiben=request("kaiben")
  57. tuijian=request("tuijian")
  58.     if not(isnumeric(hw_cash)) then
  59.         errmsg="<br>"+"<li>图书的价格应该为数字"
  60.         founderr=true
  61.     end if
  62.     if hw_name="" then
  63.         errmsg=errmsg+"<br>"+"<li>图书名称不能为空"
  64.         founderr=true
  65.     end if
  66.     if hw_content="" then
  67.         errmsg=errmsg+"<Br>"+"<li>图书介绍不能为空"
  68.         founderr=true
  69.     end if
  70.     if sort_id="" then
  71.         errmsg=errmsg+"<br>"+"<li>图书类别不能为空"
  72.         founderr=true
  73.     end if
  74. if Nsort_id="" then
  75.         errmsg=errmsg+"<br>"+"<li>图书类别不能为空"
  76.         founderr=true
  77.     end if
  78.    
  79.     
  80.     if hw_pic="" then hw_pic="img/noimage.gif"
  81.     
  82.     if founderr=true then
  83.         response.write errmsg
  84.         response.write "<br>"
  85.         response.write "<a href=addhw.asp>返回</a>"
  86.         response.end
  87.     else
  88.         hw_name=server.htmlencode(hw_name)
  89.         hw_name=replace(hw_name," ","&nbsp;")
  90.         hw_name=replace(hw_name,chr(13)&chr(10),"<Br>")
  91.         
  92.         
  93.         hw_content=server.htmlencode(hw_content)
  94.         hw_content=replace(hw_content," ","&nbsp;")
  95.         hw_content=replace(hw_content,chr(13)&chr(10),"<Br>")        
  96.         
  97.         hw_pic=server.htmlencode(hw_pic)    
  98.         
  99.         sql="select * from hw where hw_id="&request("hw_id")
  100.         rs.open sql,conn,3,3
  101.         rs("hw_name")=hw_name
  102.         rs("hw_content")=hw_content
  103.         rs("hw_cash")=hw_cash
  104.         rs("sort_id")=sort_id
  105. rs("Nsort_id")=Nsort_id
  106.        rs("company")=company
  107.        rs("daili")=daili
  108.        rs("pifa")=pifa
  109.        rs("hw_sn")=hw_sn
  110.    rs("chubsh")=chubsh
  111.    rs("kaiben")=kaiben
  112.    rs("yeshu")=yeshu
  113.    rs("data")=data
  114.    rs("isbn")=isbn
  115.    rs("zhuang")=zhuang
  116.         rs("hw_pic")=hw_pic
  117. rs("tuijian")=tuijian
  118.         rs.update
  119.     end if
  120.     response.write "商品修改成功!"
  121.     response.write "<br>"
  122.     response.write "<a href=delhw.asp>返回</a>"
  123.     rs.close
  124. else
  125. %>
  126. <table width="500" border="0" cellspacing="0" cellpadding="0" align="center" height="100" bgcolor="6894d8">
  127.   <tr> 
  128.     <td height="175"> 
  129.       <form name="form1" method="post" action="changehw.asp?hw_id=<%=hw_id%>&action=save">
  130.         <table border="0" width="100%" cellspacing="1">
  131.           <tr bgcolor="#FFFFFF"> 
  132.             <td colspan="2"><font color="#FF0000">商品名称</font> 
  133.               <input type="text" name="hw_name" size="20" class=input value="<%=hw_name%>">
  134.               <font color="#FF0000"> &nbsp;&nbsp;&nbsp;&nbsp; 商品类别 </font>
  135. <select class="smallSel" name="sort_id" size="1">      
  136. <%
  137. dim rs,sql,sel
  138. dim content
  139. sort_id=request("sort_id")
  140. Nsort_id=request("Nsort_id")
  141.   set rs=server.createobject("adodb.recordset")
  142.    sql="select * from sort"
  143.   rs.open sql,conn,1,1
  144. if rs.eof and rs.bof then
  145. response.write "Not record."
  146. else
  147. do while not rs.eof
  148.         if sort_id=cstr(rs("sort_id")) then
  149.                sel="selected"
  150.         else
  151.                sel=""
  152.         end if
  153. response.write "<option " & sel & " value='"+CStr(rs("sort_ID"))+"' name=sort_id>"+rs("sort_name")+"</option>"+chr(13)+chr(10)
  154. rs.movenext
  155.      loop
  156. end if
  157. rs.close
  158. %>        
  159. </select>
  160. &nbsp;&nbsp;选择分类: <select name="Nsort_id" size="1">
  161. <%
  162.    sql="select * from Nsort"
  163.   rs.open sql,conn,1,1
  164. if rs.eof and rs.bof then
  165. response.write "Not record."
  166. else
  167.         do while not rs.eof
  168.         if Nsort_id=cstr(rs("Nsort_id")) then
  169.                sel="selected"
  170.         else
  171.                sel=""
  172.         end if
  173.         response.write "<option " & sel & " value='" +  Cstr(rs("Nsort_id")) + "'>" + rs("Nsort_name") + "</option>"
  174.         rs.MoveNext
  175.         Loop
  176. end if
  177.         rs.close
  178. %>
  179.       </select>**
  180. </td>
  181.           </tr>
  182.           <tr bgcolor="#FFFFFF"> 
  183.             <td colspan="2"><font color="#FF0000">商品原价</font> 
  184.               <input type="text" name="pifa" size="7" class=input value="<%=pifa%>">
  185.               元 <font color="#FF0000">&nbsp;&nbsp;&nbsp;&nbsp;会员价格</font> 
  186.               <input type="text" name="hw_cash" size="7" class=input value="<%=hw_cash%>">
  187.               元 <font color="#FF0000">&nbsp;&nbsp;&nbsp;&nbsp;VIP价格 </font> 
  188.               <input type="text" name="daili" size="7" class=input value="<%=daili%>">
  189.               元 </td>
  190.           </tr>
  191.           <tr bgcolor="#FFFFFF"> 
  192.             <td height="5" colspan="2"> 
  193.               <hr noshade size="1">
  194.             </td>
  195.           </tr>
  196.           <tr bgcolor="#FFFFFF"> 
  197.             <td width="25%">作者 
  198.               <input type="text" name="hw_sn" size="10" class=input value="<%=hw_sn%>">
  199.             </td>
  200.             <td width="75%"> 公司
  201. <input type="text" name="chubsh" size="30" class=input value="<%=chubsh%>">
  202.             </td>
  203.           </tr>
  204.           <tr bgcolor="#FFFFFF"> 
  205.             <td width="25%">尺码
  206. <input type="text" name="yeshu" size="10" class=input value="<%=yeshu%>">
  207.             </td>
  208.             <td width="75%">出版日期 
  209.               <input type="text" name="data" size="24" class=input value="<%=data%>">
  210.               格式:2002-10-10</td>
  211.           </tr>
  212.           <tr bgcolor="#FFFFFF"> 
  213.             <td width="25%">颜色
  214. <input type="text" name="kaiben" size="10" class=input value="<%=kaiben%>">
  215.             </td>
  216.             <td width="75%"> 编号
  217. <input type="text" name="isbn" size="30" class=input value="<%=isbn%>">
  218.             </td>
  219.           </tr>
  220.           <tr bgcolor="#FFFFFF"> 
  221.             <td height="5" colspan="2"> 
  222.               <hr noshade size="1">
  223.             </td>
  224.           </tr>
  225.           <tr bgcolor="#FFFFFF"> 
  226.             <td colspan="2"> 包装类型 
  227.               <input type="text" name="zhuang" size="30" class=input value="<%=zhuang%>">
  228.             </td>
  229.           </tr>
  230.           <tr bgcolor="#FFFFFF"> 
  231.             <td colspan="2"> <font color="#FF0000">内容简介 </font></td>
  232.           </tr>
  233.           <tr bgcolor="#FFFFFF"> 
  234.             <td valign="top" colspan="2"> 
  235.               <textarea rows="3" name="hw_content" cols="50" class=input><%=hw_content%></textarea>
  236.             </td>
  237.           </tr>
  238.           <tr bgcolor="#FFFFFF"> 
  239.             <td colspan="2"> <font color="#FF0000">商品图片</font> 
  240.               <input type="text" name="hw_pic" size="46" class=input value="<%=hw_pic%>">
  241.               <a href="../up/index.asp" target="_blank"><font color="#FF0000">图形上传</font></a></td>
  242.           </tr>
  243.           <tr bgcolor="#FFFFFF" align="center"> 
  244.             <td colspan="2"> 
  245.               <input type="submit" name="Submit" value="修改">
  246.             </td>
  247.           </tr>
  248.         </table>
  249.       </form>
  250.     </td>
  251.   </tr>
  252. </table>
  253.      <%
  254. end if
  255. set rs=nothing
  256. conn.close
  257. set conn=nothing
  258. %>