<%@ Language=VBScript %>
<%
' ****************************************************
' Shipping.asp - Provides for the user to enter in
' shipping data for the store. It will check to
' see if a profile can be retrieved.
' ****************************************************
' Check to ensure a basket has been created.
if session("idBasket") = "" then
' Redirect to the basket page
Response.Redirect "basket.asp"
end if
%>
<HTML>
<!-- #include file="include/header.asp" -->
<BR>
<center>
<font size="5"><b>Shipping Information</b></font>
</center>
<%
' Check to see if a profile has been retrieved
or not.
if session("ProfileRetrieve") = "" then
' If not then we will create a link to retrieve an existing profile.
%>
<BR>
<B><i>Click <a href="profile.asp">here</a>
to retrieve an existing profile.</i></b>
<BR>
<%
else
' Check to see if the ProfileRetrieve value is 1. If not then the profile will be retrieved if possible.
' Note the ProfileRetrieve value will be 0 when a new shopper ID is created from the Header.
if session("ProfileRetrieve") <> "1" then
' Create an ADO database connection
set dbProfile = server.createobject("adodb.connection")
' Create the record set
set rsProfile = server.CreateObject("adodb.recordset")
' Open the connection using our
SQL Server DSN-less connection string
dbProfile.ConnectionString="Driver={SQL Server}; Server=cisdev.quinnipiac.edu;" & _
"Database=WildWillies;UID=cis; PWD=csatqu"
dbProfile.Open
' Build the SQL stored procedure to retrieve the profile based on the id of the shopper
' (which would be retrieved by the cookie).
sql = "execute sp_RetrieveProfileByID " & session("idShopper")
' Execute the statement
set rsProfile = dbProfile.Execute(sql)
' Set the shipping variables
session("chrShipFirstName") = rsProfile("chrFirstName")
session("chrShipLastName") = rsProfile("chrLastName")
session("chrShipAddress") = rsProfile("chrAddress")
session("chrShipCity") = rsProfile("chrCity")
session("chrShipState") = rsProfile("chrState")
session("chrShipProvince") = rsProfile("chrProvince")
session("chrShipCountry") = rsProfile("chrCountry")
session("chrShipZipCode") = rsProfile("chrZipCode")
session("chrShipPhone") = rsProfile("chrPhone")
session("chrShipEmail") = rsProfile("chrEmail")
session("chrPassword") = rsProfile("chrPassword")
session("intCookie") = rsProfile("intCookie")
end if
' Set the session so we don't retrieve the data again.
' This will ensure we don't pull the profile again.
session("ProfileRetrieve") = "1"
end if
' Check to see if an error was returned if the form was submitted
if session("Error") <> "" then
' Show the error data.
%>
<BR>
<b>You have an error in your shipping form, please correct the data:</b><BR><BR>
<!-- Build out a table to display the error. -->
<table>
<tr>
<td width="70"> </td>
<td><i><%=Response.Write(session("Error"))%></i></td>
</tr>
</table>
<BR><BR>
<%
' Clear the error variable.
session("Error") = ""
else
%>
<BR>
<b>Enter your shipping address:</b>
<BR><BR>
<%
end if
%>
<!-- This form will post to the validate page to ensure the shipping data has been entered properly. -->
<center>
<!-- Form to post the shipping data. -->
<form method="post" action="ValidateShipping.asp">
<!-- The table will display the shipping form. Note that the values will be defaulted to any session variables. -->
<table>
<!-- Shipping First Name -->
<tr>
<td align="right">First Name:</td>
<td><input type="text" value="<%=session("chrShipFirstName")%>"
name="chrShipFirstName" size="30"></td>
</tr>
<!-- Shipping Last Name -->
<tr>
<td align="right">Last Name:</td>
<td><input type="text" value="<%=session("chrShipLastName")%>"
name="chrShipLastName" size="30"></td>
</tr>
<!-- Shipping Address -->
<tr>
<td align="right">Address:</td>
<td><input type="text" value="<%=session("chrShipAddress")%>"
name="chrShipAddress" size="30"></td>
</tr>
<!-- Shipping City -->
<tr>
<td align="right">City:</td>
<td><input type="text" value="<%=session("chrShipCity")%>"
name="chrShipCity" size="30"></td>
</tr>
<!-- Shipping City -->
<tr>
<td align="right">State:</td>
<td>
<%
' Check to see which state was selected previously if there was an error.
' We then set a variable to put in the appropriate 'SELECTED' HTML tag.
if session("chrShipState") = "AL" then
SelAL = "Selected"
end if
if session("chrShipState") = "AK" then
SelAK = "Selected"
end if
if session("chrShipState") = "AZ" then
SelAZ = "Selected"
end if
if session("chrShipState") = "AR" then
SelAR = "Selected"
end if
if session("chrShipState") = "CA" then
SelCA = "Selected"
end if
if session("chrShipState") = "CT" then
SelCT = "Selected"
end if
if session("chrShipState") = "CO" then
SelCO = "Selected"
end if
if session("chrShipState") = "DC" then
SelDC = "Selected"
end if
if session("chrShipState") = "DE" then
SelDE = "Selected"
end if
if session("chrShipState") = "FL" then
SelFL = "Selected"
end if
if session("chrShipState") = "GA" then
SelGA = "Selected"
end if
if session("chrShipState") = "HI" then
SelHI = "Selected"
end if
if session("chrShipState") = "ID" then
SelID = "Selected"
end if
if session("chrShipState") = "IL" then
SelIL = "Selected"
end if
if session("chrShipState") = "IN" then
SelIN = "Selected"
end if
if session("chrShipState") = "IA" then
SelIA = "Selected"
end if
if session("chrShipState") = "KS" then
SelKS = "Selected"
end if
if session("chrShipState") = "KY" then
SelKY = "Selected"
end if
if session("chrShipState") = "LA" then
SelLA = "Selected"
end if
if session("chrShipState") = "ME" then
SelME = "Selected"
end if
if session("chrShipState") = "MA" then
SelMA = "Selected"
end if
if session("chrShipState") = "MD" then
SelMD = "Selected"
end if
if session("chrShipState") = "MI" then
SelMI = "Selected"
end if
if session("chrShipState") = "MN" then
SelMN = "Selected"
end if
if session("chrShipState") = "MS" then
SelMS = "Selected"
end if
if session("chrShipState") = "MO" then
SelMO = "Selected"
end if
if session("chrShipState") = "MT" then
SelMT = "Selected"
end if
if session("chrShipState") = "NE" then
SelNE = "Selected"
end if
if session("chrShipState") = "NV" then
SelNV = "Selected"
end if
if session("chrShipState") = "NH" then
SelNH = "Selected"
end if
if session("chrShipState") = "NJ" then
SelNJ = "Selected"
end if
if session("chrShipState") = "NM" then
SelNM = "Selected"
end if
if session("chrShipState") = "NY" then
SelNY = "Selected"
end if
if session("chrShipState") = "NC" then
SelNC = "Selected"
end if
if session("chrShipState") = "ND" then
SelND = "Selected"
end if
if session("chrShipState") = "OH" then
SelOH = "Selected"
end if
if session("chrShipState") = "OK" then
SelOK = "Selected"
end if
if session("chrShipState") = "OR" then
SelOR = "Selected"
end if
if session("chrShipState") = "PA" then
SelPA = "Selected"
end if
if session("chrShipState") = "RI" then
SelRI = "Selected"
end if
if session("chrShipState") = "SC" then
SelSC = "Selected"
end if
if session("chrShipState") = "SD" then
SelSD = "Selected"
end if
if session("chrShipState") = "TN" then
SelTN = "Selected"
end if
if session("chrShipState") = "TX" then
SelTX = "Selected"
end if
if session("chrShipState") = "UT" then
SelUT = "Selected"
end if
if session("chrShipState") = "VT" then
SelVT = "Selected"
end if
if session("chrShipState") = "VA" then
SelVA = "Selected"
end if
if session("chrShipState") = "WY" then
SelWY = "Selected"
end if
if session("chrShipState") = "WI" then
SelWI = "Selected"
end if
if session("chrShipState") = "WV" then
SelWV = "Selected"
end if
if session("chrShipState") = "WA" then
SelWA = "Selected"
end if
if session("chrShipState") = "FSO" then
SelFSO = "Selected"
end if
%>
<!-- Option box for the shipping states. Note that the past default will be selected -->
<select name="chrShipState">
<option value="">Select a State
<option value="AL" <%=SelAL%>>Alabama
<option value="AK" <%=SelAK%>>Alaska
<option value="AZ" <%=SelAZ%>>Arizona
<option value="AR" <%=SelAR%>>Arkansas
<option value="CA" <%=SelCA%>>California
<option value="CT" <%=SelCT%>>Connecticut
<option value="CO" <%=SelCO%>>Colorado
<option value="DC" <%=SelDC%>>D.C.
<option value="DE" <%=SelDE%>>Delaware
<option value="FL" <%=SelFL%>>Florida
<option value="GA" <%=SelGA%>>eorgia
<option value="HI" <%=SelHI%>>Hawaii
<option value="ID" <%=SelID%>>Idaho
<option value="IL" <%=SelIL%>>Illinois
<option value="IN" <%=SelIN%>>Indiana
<option value="IA" <%=SelIA%>>Iowa
<option value="KS" <%=SelKS%>>Kansas
<option value="KY" <%=SelKY%>>Kentucky
<option value="LA" <%=SelLA%>>Louisiana
<option value="ME" <%=SelME%>>Maine
<option value="MA" <%=SelMA%>>Massachusetts
<option value="MD" <%=SelMD%>>Maryland
<option value="MI" <%=SelMI%>>Michigan
<option value="MN" <%=SelMN%>>Minnesota
<option value="MS" <%=SelMS%>>Mississippi
<option value="MO" <%=SelMO%>>Missouri
<option value="MT" <%=SelMT%>>Montana
<option value="NE" <%=SelNE%>>Nebraska
<option value="NV" <%=SelNV%>>Nevada
<option value="NH" <%=SelNH%>>New Hampshire
<option value="NJ" <%=SelNJ%>>New Jersey
<option value="NM" <%=SelNM%>>New Mexico
<option value="NY" <%=SelNY%>>New York
<option value="NC" <%=SelNC%>>North Carolina
<option value="ND" <%=SelND%>>North Dakota
<option value="OH" <%=SelOH%>>Ohio
<option value="OK" <%=SelOK%>>Oklahoma
<option value="OR" <%=SelOR%>>Oregon
<option value="PA" <%=SelPA%>>Pennsylvania
<option value="RI" <%=SelRI%>>Rhode Island
<option value="SC" <%=SelSC%>>South Carolina
<option value="SD" <%=SelSD%>>South Dakota
<option value="TN" <%=SelTN%>>Tennessee
<option value="TX" <%=SelTX%>>Texas
<option value="UT" <%=SelUT%>>Utah
<option value="VT" <%=SelVT%>>Vermont
<option value="VA" <%=SelVA%>>Virginia
<option value="WA" <%=SelWA%>>Washington
<option value="WY" <%=SelWY%>>Wyoming
<option value="WI" <%=SelWI%>>Wisconsin
<option value="WV" <%=SelWV%>>West Virginia
<OPTION value="FSO" <%=SelFSO%>>Military Stuff
</select>
<!-- Province option -->
or Province:<input type="text"
value="<%=trim(session("chrShipProvince"))%>"
name="chrShipProvince" size="15">
</td>
</tr>
<!-- Shipping Country -->
<tr>
<td align="right">Country:</td>
<td>
<%
' Check to see which country was selected previously if there was an error.
' We then set a variable to set the 'Selected' tag.
if session("chrShipCountry") = "US" then
SelUS = "Selected"
end if
if session("chrShipCountry") = "CA" then
SelCA = "Selected"
end if
if session("chrShipCountry") = "MX" then
SelMX = "Selected"
end if
%>
<!-- Option box for the country with the past country defaulted -->
<select name="chrShipCountry">
<option value="">Select a Country
<option value="US" <%=SelUS%>>United States
<option value="CA" <%=SelCA%>>Canada
<option value="MX" <%=SelMX%>>Mexico
</select>
</td>
</tr>
<!-- Shipping Zip Code or Postal Code -->
<tr>
<td align="right">Zip/Postal Code:</td>
<td><input type="text" value="<%=session("chrShipZipCode")%>"
name="chrShipZipCode" size="30"></td>
</tr>
<!-- Shipping Phone -->
<tr>
<td align="right">Phone:</td>
<td><input type="text" value="<%=session("chrShipPhone")%>"
name="chrShipPhone" size="30"></td>
</tr>
<!-- Shipping Email -->
<tr>
<td align="right">Email:</td>
<td><input type="text" value="<%=session("chrShipEmail")%>"
name="chrShipEmail" size="30"></td>
</tr>
<!-- Submit Button -->
<tr>
<td colspan="2" align="center">
<input type="Submit" value="Submit" name="Submit">
</td>
</tr>
</table>
</form>
</center>
<!-- #include file="include/footer.asp" -->
</BODY>
</HTML> |