?? addhw.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 href=../style.css rel=STYLESHEET type=text/css>
</head>
<%
if request("action")="save" then
hw_name=request("hw_name")
hw_content=request("hw_content")
hw_cash=request("hw_cash")
hw_pic=request("hw_pic")
sort_id=request("sort_id")
hw_oldcash=request("hw_oldcash")
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 hw_oldcash="" then
errmsg=errmsg+"<br>"+"<li>貨物原價不能為空"
founderr=true
end if
if hw_pic="" then hw_pic="images/noimage.gif"
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," "," ")
hw_name=replace(hw_name,chr(13)&chr(10),"<Br>")
hw_content=server.htmlencode(hw_content)
hw_content=replace(hw_content," "," ")
hw_content=replace(hw_content,chr(13)&chr(10),"<Br>")
hw_pic=server.htmlencode(hw_pic)
sql="select * from hw"
rs.open sql,conn,3,3
rs.addnew
rs("hw_name")=hw_name
rs("hw_content")=hw_content
rs("hw_cash")=hw_cash
rs("sort_id")=sort_id
rs("hw_oldcash")=hw_oldcash
rs("hw_pic")=hw_pic
rs.update
end if
response.write "貨物添加成功"
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">
<table border="0" width="100%" cellspacing="1">
<tr>
<td width="100%">商品類別<select size="1" name="sort_id">
<%
sql="select * from sort"
rs.open sql,conn,3,3
if rs.eof then
%><option value=""></option>
<%else
do while not rs.eof%>
<option value="<%=rs("sort_id")%>"><%=rs("sort_name")%></option><%rs.movenext
loop
end if
rs.close%>
</select></td>
</tr>
<tr>
<td width="100%">商品名稱<input type="text" name="hw_name" size="20" class=input></td>
</tr>
<tr>
<td width="100%">商品原價<input type="text" name="hw_oldcash" size="20" class=input></td>
</tr>
<tr>
<td width="100%">商品價格<input type="text" name="hw_cash" size="20" class=input><font color="#FF0000">不支持小數,小數點后四舍五入</font></td>
</tr>
<tr>
<td width="100%">商品介紹</td>
</tr>
<tr>
<td width="100%"><textarea rows="9" name="hw_content" cols="77" class=input></textarea></td>
</tr>
<tr>
<td width="100%">商品圖片<input type="text" name="hw_pic" size="46" class=input></td>
</tr>
</table>
<p><input type="submit" value="提交" name="B1" class=input><input type="reset" value="全部重寫" name="B2" class=input></p>
</form>
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=upload.asp></iframe> </td>
</tr>
</table>
<%
end if
set rs=nothing
conn.close
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -