shopcustomer.asp

来自「ASP+SQL Server动态网站开发从基础到实践教程」· ASP 代码 · 共 127 行

ASP
127
字号
<!--#include file="shop$db.asp"-->
<%
'******************************************************************************.
%>
<%
Dim msg, newcust
Session("CurrentURL")="shopcustomer.asp"
Session("FollowonURL")="shopshipping.asp"
if Session("cartItem")=0  or Session("cartitem")="" then
    Response.Redirect "shoperror.asp?msg=" & Server.URLEncode ("目前购物篮中没有商品")
end if
If request("new")<>"" then
    ResetCustomerSessionData
end if
If Session("LastName")<> "" and Session("Customerid") <>"" then
         response.redirect Session("followonurl")
end if 
ShopGetContact
'**************************************************
Sub ShopGetContact()
sAction=Request.form("Action")
If sAction = "" Then
     ShopPageHeader
     GetCustomerSessionData()
     DisplayForm()
     ShopPageTrailer
Else
     ValidateData()
     if sError = "" Then
         UpdateContact
         UpdateCustomerSessionData
         response.redirect Session("followonurl")
      else
          ShopPageHeader
          DisplayForm
          ShopPageTrailer
       end if
end if
end Sub

Sub DisplayForm()
	Dim sRowColor
	sRowColor="#C4CEE5"
	Response.Write("<blockquote>")
        response.write ("<p><font size=2><a href=shoplogin.asp>登记用户请进</a></font></p>")
        if sError<> "" then
            response.write "<b>" & SError & "</b>"
            Serror=""
        end if
	Response.Write("<font color=red>" & sError & "</font><p>")
	Response.Write("<form name=form1 method=Post action=" & Session("currenturl") & ">")
	Response.Write("<table cellpadding=2 cellspacing=2>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>姓:</td><td><input size=50 name=strFirstname value=" & Chr(34) & strFirstname & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>名:</td><td><input size=50 name=strLastname value=" & Chr(34) & strLastname & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>地址:</td><td><input size=50 name=strAddress value=" & Chr(34) & strAddress & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>城市:</td><td><input size=50 name=strCity value=" & Chr(34) & strCity & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>州:</td><td><input size=10 name=strState value=" & Chr(34) & strState & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>邮编:</td><td><input size=10 name=strPostCode value=" & Chr(34) & strPostCode & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>电话:</td><td><input size=20 name=strPhone value=" & Chr(34) & strPhone & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>Email:</td><td><input size=50 name=strEmail value=" & Chr(34) & strEmail & Chr(34) & "></td></tr>")
	Response.Write("</table><p>")
        Response.Write("<br>")
        Response.Write("<b> 下面的信息用户可以不填:")
	Response.Write("<table cellpadding=2 cellspacing=2>")

	Response.Write("<tr bgcolor=" & sRowColor &"><td>公司:</td><td><input size=50 name=strCompany value=" & Chr(34) & strCompany & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>个人主页:</td><td><input size=50 name=strwebsite value=" & Chr(34) & strWebSite & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>工作电话:</td><td><input size=20 name=strWorkphone value=" & Chr(34) & strWorkphone & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>移动电话:</td><td><input size=20 name=strMobilephone value=" & Chr(34) & strMobilephone & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>传真:</td><td><input size=20 name=strFax value=" & Chr(34) & strFax & Chr(34) & "></td></tr>")
	Response.Write("<tr bgcolor=" & sRowColor &"><td>国家:</td><td><input size=20 name=strCountry value=" & Chr(34) & strCountry & Chr(34) & "></td></tr>")
	Response.Write("</table><p>")
	Response.Write("<input type=submit name=action value=继续>")
	Response.Write("</form>")
	Response.Write("</blockquote>")
End Sub
Sub ValidateData()
	strFirstname = Request.Form("strFirstname")
	strLastname = Request.Form("strLastname")
	strAddress = Request.Form("strAddress")
	strCity = Request.Form("strCity")
	strState = Request.Form("strState")
	strPostCode = Request.Form("strPostCode")
	strCountry = Request.Form("strCountry")
	strCompany = Request.Form("strCompany")
	strWebsite = Request.Form("strWebsite")
	strPhone = Request.Form("strPhone")
	strWorkphone = Request.Form("strWorkphone")
	strMobilephone = Request.Form("strMobilephone")
	strFax = Request.Form("strFax")
	strEmail = Request.Form("strEmail")
	If strFirstname = "" Then
		sError = sError & "名不可为空<br>"
	End If 

	If strLastname = "" Then
		sError = sError & "姓不可为空<br>"
	End If 

	If strAddress = "" Then
		sError = sError & "地址不可为空<br>"
	End If 

	If strCity = "" Then
		sError = sError & "城市不可为空<br>"
	End If 

	If strState = "" Then
		sError = sError & "州不可为空<br>"
	End If 

	If strPostCode = "" Then
		sError = sError & "邮编不可为空<br>"
	End If 

	If strPhone = "" Then
		sError = sError & "电话不可为空<br>"
	End If 

	If strEmail = "" Then
		sError = sError & "Email不可为空<br>"
	End If 
	strContactreason = ListType
end sub

%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?