📄 addcustomer.asp
字号:
<%@ Language=VBScript %>
<%
'This file adds the customer address and data to the db
%>
<!-- #include file="db.inc" -->
<%
For Each key in Request.Form
strname = key
strvalue = Request.Form(key)
Session(strname) = strvalue
Next
fname = Request.Form("fname")
lname = Request.Form("lname")
email = Request.Form("email")
address = Request.Form("address")
town = Request.Form("town")
zip = Request.Form("zip")
country = Request.Form("country")
phone = Request.Form("phone")
If fname = "" OR len(fname) <=2 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your first name.")
Elseif lname = "" OR len(lname) <=2 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your last name.")
Elseif email = "" OR len(email) <=7 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your e-mail address in this format: name@urlogy.com.")
Elseif address = "" OR len(address) <=7 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your address.")
Elseif town = "" OR len(town) <=2 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your town or city.")
Elseif zip = "" OR len(zip) <=3 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your zip (postal) code.")
Elseif country = "" OR len(country) <=4 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your country name.")
Elseif phone = "" OR len(phone) <=4 then
Response.Redirect "customer.asp?msg=" & Server.URLEncode ("Please fill in your phone number.")
Else
Set rsc = Server.CreateObject ("ADODB.Recordset")
rsc.Open "customers", dbc, adOpenStatic, adLockPessimistic, adCmdTable
rsc.AddNew
rsc("cfirstname") = fname
rsc("clastname") = lname
rsc("cemail") = email
rsc("caddress") = Request.Form("address")
If Request.Form("address2") <> "" Then
rsc("caddress2") = Request.Form("address2")
End If
rsc("ctown") = town
rsc("czip") = zip
If Request.Form("state") <> "" Then
rsc("cstate") = Request.Form("state")
End if
rsc("ccountry") = country
rsc("cphone") = phone
If Request.Form("cfax") <> "" Then
rsc("cfax") = Request.Form("fax")
End If
rsc.Update
sql = "SELECT max(custID) from customers"
set rs = dbc.Execute(sql)
CustomID = rs(0)
rs.Close
dbc.Close
Session("customerid") = CustomID
Response.Redirect "checkout.asp"
End If
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -