Forum Moderators: open

Message Too Old, No Replies

Passing a variable to the next page

using a form

         

Bishop

5:16 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



I am unable to pass the variable "gsTotal" to my confirmation.asp page so that I can track the total amount of the conversion using Google's tool. Any help would be great on how to do this. It echos to the screen below using <%gsTotal%>, I just can't get it to pass so I can echo it on confirmation.asp and then insert into Goggle's tracking code.

I hope it is ok that I have pasted the entire page. Any help with this would be tremendously appreciated.

<%@ Language=VBScript %>
<!--#Include File="ErrHandler.asp"-->
<%

'build the Payment Info cookie
if Request.Cookies("PaymentInfo")("CCType")= "" then
Response.Cookies("PaymentInfo")("CCMonth") =Request("CCMonth")
Response.Cookies("PaymentInfo")("CCYear") =Request("CCYear")
Response.Cookies("PaymentInfo")("CCHolderName") =Request("CCHolderName")
Response.Cookies("PaymentInfo")("CCNumber") =Request("CCNumber")

For Each cookie in Response.Cookies
Response.Cookies(cookie).Expires = #Jan 4, 2010#
Next

end if
Dim gsCartHTML
Dim gsSubTotal
Dim gsTax
Dim gsTotal

call Main()

Sub Main()

If Session("LoggedIn") Then

' If the user is not from VA, clear all sales tax
If UCase(Request.Form("hiddenShipState")) <> "VA" Then
ClearSalesTax Session.SessionID
End If

gsCartHTML = GetCartHTML(Session.SessionID)
End If

End Sub

Function GetCartHTML(SessionID)

On Error Resume Next

Dim outputHTML
Dim objCart
Dim adoRS
Dim WarrantyText
Dim WarrantyPrice
Dim PartPrice
Dim BasePrice
Dim aRetVals

Set objCart = Server.CreateObject("StoreObjects.CStoreOrders")

Set adoRS = objCart.GetCartParts(SessionID, aRetVals)

If Not IsEmpty(aRetVals) Then
ObjErrHandler aRetVals
Set objCart = Nothing
Set adoRS = Nothing
Exit Function
End If

If adoRS.EOF And adoRS.BOF Then
outputHTML = CartEmptyMessage
Else
Do Until adoRS.EOF
If adoRS("warranty") = 1 Then
WarrantyText = "Free 1yr Warranty"
WarrantyPrice = 0
Else
WarrantyText = "Warranty(<font color=""#FF0000"">" & FormatCurrency(adoRS("WarrantyPrice"),2) & "</font>)"
WarrantyPrice = adoRS("WarrantyPrice")
End If

PartPrice = adoRS("baseprice") + WarrantyPrice + adoRS("shipprice")' + adoRS("coreprice")

gsSubTotal = gsSubTotal + PartPrice

gsTax = gsTax + adoRS("Sales_Tax")

outputHTML = outputHTML & "<td valign=""top"" width=""1062""><font face=""Arial"" size=""1"">"
outputHTML = outputHTML & adoRS("year") & " " & adoRS("make") & " " & adoRS("model") & " " & adoRS("part_desc") & "</font></td>"
outputHTML = outputHTML & "<td valign=""top"" width=""57"" align=""right""></td>"
outputHTML = outputHTML & "</tr>"
outputHTML = outputHTML & "<tr>"
outputHTML = outputHTML & "<td valign=""top"" width=""1062"" bgcolor=""#E5E5E5"">"

'outputHTML = outputHTML & "+ Core(<font color=""#FF0000"">" & FormatCurrency(adoRS("coreprice"), 2) & "</font>) + " & WarrantyText & "</font></font></td>"
outputHTML = outputHTML & "<font face=""arial"" size=""1""><font face=""Arial"" size=""1"">Part Price(<font color=""#FF0000"">" & FormatCurrency(adoRS("baseprice"),2) & "</font>) + Shipping(<font color=""#FF0000"">" & FormatCurrency(adoRS("shipprice"), 2) & "</font>)"

outputHTML = outputHTML & "+ " & WarrantyText & "</font></font></td>"

outputHTML = outputHTML & "<td valign=""top"" width=""57"" bgcolor=""#E5E5E5"" align=""right"">"
outputHTML = outputHTML & "<font face=""Arial"" size=""1""><p align=""right""><font color=""#FF0000"">" & FormatCurrency(PartPrice, 2) & "</font></font></font></td>"
outputHTML = outputHTML & "</tr>"

adoRS.MoveNext
Loop
End If

gsTotal = gsSubTotal + gsTax

GetCartHTML = outputHTML

Set objCart = Nothing
Set adoRS = Nothing

If err.number > 0 Then
ShowASPErrMessage err.number,err.description,"GetCartHTML",err.source
End If

End Function

Sub ClearSalesTax(CartID)

On Error Resume Next

Dim objCart
Dim aRetVals

Set objCart = Server.CreateObject("StoreObjects.CStoreOrders")

objCart.ClearSalesTaxFromCart CartID, aRetVals

If Not IsEmpty(aRetVals) Then
ObjErrHandler aRetVals
Set objCart = Nothing
Exit Sub
End If

Set objCart = Nothing

If err.number > 0 Then
ShowASPErrMessage err.number,err.description,"GetCartHTML",err.source
End If

End Sub

Function CartEmptyMessage()

Dim outputHTML

outputHTML = outputHTML & "<td valign=""top"" width=""1062""><font face=""Arial"" size=""2"">"
outputHTML = outputHTML & "<b>Your Cart Is Empty Or Your Session May Have Timmed Out.</b></font></td>"
outputHTML = outputHTML & "<td valign=""top"" width=""57"" align=""right""></td>"
outputHTML = outputHTML & "</tr>"

CartEmptyMessage = outputHTML

End Function
%>
<html>

<head>
<title>Check Out</title>
<link REL="STYLESHEET" TYPE="text/css" HREF="global.css">

<script src="https://3942.clickalyzer.com/trknew.php?caUid=3942&campid=4214" type="text/javascript" language="javascript"></script>

</head>

<body leftmargin="0" bgcolor="#FFFFFF">

<table border="0" width="500" cellspacing="1" cellpadding="0">
<tr>
<td width="598"><map name="FPMap0">
<area href="default.asp" shape="rect" coords="162, 0, 189, 25">
<area href="javascript:window.history.back(1);window.history.back(1);window.history.back(1)" shape="rect" coords="240, 0, 266, 26">
<area href="shopping_cart.asp" shape="rect" coords="318, 0, 344, 26"></map><img BORDER="0" src="Images/top_step4.gif" WIDTH="440" HEIGHT="46" usemap="#FPMap0"></td>
</tr>
<tr>
<td width="598" height="10"></td>
</tr>
<tr>
<td width="598"><p align="center"><img src="../images/red_bar.gif" width="434" height="9"></td>
</tr>
</table>
<form method="POST" action="confirmation.asp" name="frmMain">
<input type="hidden" name="hiddenCCNumber" size="25" value="<%=Request.Form("CCNumber")%>"><input type="hidden" name="hiddenCCHolderName" size="25" value="<%=Request.Form("CCHolderName")%>"><input type="hidden" name="hiddenCCValidTo" size="7" value="<%=Request.Form("CCMonth") & "/" & Request.Form("CCYear")%>"><input type="hidden" name="hiddenCCType" size="20" value="<%=Request.Form("CCType")%>"><input type="hidden" name="hiddenShipZip" size="28" value="<%=Request.Form("hiddenShipZip")%>"><input type="hidden" name="hiddenShipState" size="28" value="<%=Request.Form("hiddenShipState")%>"><input type="hidden" name="hiddenShipCity" size="28" value="<%=Request.Form("hiddenShipCity")%>"><input type="hidden" name="hiddenShipAddress2" size="28" value="<%=Request.Form("hiddenShipAddress2")%>"><input type="hidden" name="hiddenShipAddress" size="28" value="<%=Request.Form("hiddenShipAddress")%>"><input type="hidden" name="hiddenContact" size="28" value="<%=Request.Form("hiddenContact")%>"><input type="hidden" name="hiddenEmail" size="28" value="<%=Request.Form("hiddenEmail")%>"><input type="hidden" name="hiddenPhone" size="28" value="<%=Request.Form("hiddenPhone")%>"><input type="hidden" name="hiddenZip" size="28" value="<%=Request.Form("hiddenZip")%>"><input type="hidden" name="hiddenState" size="28" value="<%=Request.Form("hiddenState")%>"><input type="hidden" name="hiddenCity" size="28" value="<%=Request.Form("hiddenCity")%>"><input type="hidden" name="hiddenAddress2" size="28" value="<%=Request.Form("hiddenAddress2")%>"><input type="hidden" name="hiddenAddress" size="28" value="<%=Request.Form("hiddenAddress")%>"><input type="hidden" name="hiddenCompany" size="28" value="<%=Request.Form("hiddenCompany")%>"><input type="hidden" name="hiddenLastName" size="28" value="<%=Request.Form("hiddenLastName")%>"><input type="hidden" name="hiddenFirstName" size="28" value="<%=Request.Form("hiddenFirstName")%>"><input type="hidden" name="hiddenUserID" size="28" value="<%=Request.Form("hiddenUserID")%>">
<table border="1" width="500" cellspacing="0" cellpadding="0" bordercolor="#808080" bordercolorlight="#808080" bordercolordark="#808080">
<tr>
<td width="100%"><table border="0" width="504" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#C0C0C0" width="1064"><b><font size="1" face="Arial">Parts</font></b></td>
<td bgcolor="#C0C0C0" width="55"><b><font size="1" face="Arial">Price</font></b></td>
</tr>
<%=gsCartHTML%>
<tr>
<td width="411" align="right"><p align="right"><font face="Arial" size="1"><b>Subtotal:</b></font></td>
<td width="87" align="right"><font color="#FF0000"><font size="1" face="Arial"><%=FormatCurrency(gsSubTotal,2)%></a></font></td>
</tr>
<tr>
<td width="411" align="right"><font face="Arial" size="1"><b>VA Sales Tax:</b></font></td>
<td width="87" align="right"><font color="#FF0000"><font size="1" face="Arial"><%=FormatCurrency(gsTax,2)%></a></font></td>
</tr>
<tr>
<td width="411" align="right"><font face="Arial" size="1"><b>Total:</b></font></td>
<td width="87" align="right"><font color="#FF0000"><font size="1" face="Arial"><%=FormatCurrency(gsTotal,2)%></a></font></td>
</tr>

</table>

Bishop

5:17 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



Continued...

<table border="0" width="503" cellspacing="1" cellpadding="0" height="209">
<tr>
<td bgcolor="#C0C0C0" width="1118" colspan="3" height="1"><b><font face="Arial" size="1">Billing
Address</font></b></td>
</tr>
<tr>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>First Name</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Last Name</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Company</b></font></td>
</tr>
<tr>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenFirstName")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenLastName")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenCompany")%></font></td>
</tr>
<tr>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Address</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Address2</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>City</b></font></td>
</tr>
<tr>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenAddress")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenAddress2")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenCity")%></font></td>
</tr>
<tr>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>State</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Zip</b></font></td>
<td width="167" height="16" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Phone</b></font></td>
</tr>
<tr>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenState")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenZip")%></font></td>
<td width="167" height="16"><font size="1" face="Arial"><%=Request.Form("hiddenPhone")%></font></td>
</tr>
<tr>
<td width="501" height="8" bgcolor="#E5E5E5" colspan="3"><font size="1" face="Arial"><b>Email</b></font></td>
</tr>
<tr>
<td width="167" height="8"><font size="1" face="Arial"><%=Request.Form("hiddenEmail")%></font></td>
<td width="167" height="8"></td>
<td width="167" height="8"></td>
</tr>
<tr>
<td bgcolor="#C0C0C0" width="1118" bordercolor="#C0C0C0" colspan="3" height="16"><b><font face="Arial" size="1">Shipping
Address</font></b></td>
</tr>
<tr>
<td width="167" height="6" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Contact</b></font></td>
<td width="167" height="6" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Address</b></font></td>
<td width="167" height="6" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Address2</b></font></td>
</tr>
<tr>
<td width="167" height="5"><font size="1" face="Arial"><%=Request.Form("hiddenContact")%></font></td>
<td width="167" height="5"><font size="1" face="Arial"><%=Request.Form("hiddenShipAddress")%></font></td>
<td width="167" height="5"><font size="1" face="Arial"><%=Request.Form("hiddenShipAddress2")%></font></td>
</tr>
<tr>
<td width="167" height="3" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>City</b></font></td>
<td width="167" height="3" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>State</b></font></td>
<td width="167" height="3" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Zip</b></font></td>
</tr>
<tr>
<td width="167" height="2"><font size="1" face="Arial"><%=Request.Form("hiddenShipCity")%></font></td>
<td width="167" height="2"><font size="1" face="Arial"><%=Request.Form("hiddenShipState")%></font></td>
<td width="167" height="2"><font size="1" face="Arial"><%=Request.Form("hiddenShipZip")%></font></td>
</tr>
</table>
<table border="0" width="503" cellspacing="1" cellpadding="0" height="65">
<tr>
<td bgcolor="#C0C0C0" width="1118" colspan="4" height="16"><b><font face="Arial" size="1">Billing
Information</font></b></td>
</tr>
<tr>
<td width="105" height="18" align="left" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Credit Card</b></font></td>
<td width="86" height="18" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Expiration Date</b></font></td>
<td width="155" height="18" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Card Holder's Name</b></font></td>
<td width="151" height="18" bgcolor="#E5E5E5"><font size="1" face="Arial"><b>Card Number</b></font></td>
</tr>
<tr>
<td width="105" height="1" align="left"><font size="1" face="Arial"><%=Request.Form("CCType")%></font></td>
<td width="86" height="1"><font size="1" face="Arial"><%=Request.Form("CCMonth") & "/" & Request.Form("CCYear")%></font></td>
<td width="155" height="1"><font size="1" face="Arial"><%=Request.Form("CCHolderName")%></font></td>
<td width="151" height="1"><font size="1" face="Arial"><%=Request.Form("CCNumber")%></font></td>
</tr>
<tr>
<td width="1118" height="16" align="right" bgcolor="#C0C0C0" colspan="4">
<!-- <p align="left"><b><font face="Arial" size="1">Comments-NOTE More than 220 characters or punctuation can cause an ASP Script ERROR</font></b> --></td>
</tr>
<tr>
<td width="1118" height="14" align="right" colspan="4">
<!--<p align="left"><font face="Arial" size="1"><textarea rows="2" name="CustomerComments" cols="59"></textarea></font>--></td>
</tr>
</table>
<table border="0" cellspacing="0" width="504" cellpadding="0" height="27">
<tr>
<td width="502" height="3" bgcolor="#C0C0C0" colspan="3">
</td>
</tr>
<tr>
<td width="72" height="20">
<p align="left"><a HREF="javascript:window.history.back(1);"><img alt BORDER="0" src="images/btn_back.gif" style="CURSOR: hand" WIDTH="48" HEIGHT="15"></a></td>
<td width="292" height="20">
<p align="left"><font size="2" face="Arial"><b>I have read and agree to the Terms Of Sale. Pre-install requirements must be followed for warranty to be valid. Please print terms for requirements on this part.</b></font></td>
<p align="left"><font size="2" face="Arial"><b>LABOR IS NOT COVERED UNDER WARRANTY</b></font></td>
<td width="134" height="20">
<p align="left"><a HREF="javascript:document.frmMain.submit();"><img BORDER="0" src="images/agree.gif" alt="I Agree" class="clsNavButton" WIDTH="58" HEIGHT="16"></a></td>
</tr>
</table>
</td>
</tr>

</table>
</form>
<table border="0" width="500" cellspacing="0" cellpadding="0">

<tr>
<td width="498" height="10" colspan="2"></td>
</tr>
<tr>
<td width="498" colspan="2"><p align="center"><img src="images/nav_left.gif" alt WIDTH="36" HEIGHT="26"><a href="shopping_cart.asp"><img src="images/nav_viewcart.gif" alt="View Cart" class="clsNavButton" WIDTH="86" HEIGHT="26" border="0"></a><a href="special_order.asp"><img class="clsNavButton" src="images/nav_specialorder.gif" WIDTH="103" HEIGHT="26" border="0" alt="Special Order"></a><a href="check_out_help.htm"><img class="clsNavButton" src="images/nav_help.gif" WIDTH="86" HEIGHT="26" border="0" alt="Help"></a><a href="sales_terms.asp"><img class="clsNavButton" src="images/nav_terms.gif" WIDTH="86" HEIGHT="26" border="0" alt="Sales Terms"></a><img src="images/nav_right.gif" alt WIDTH="36" HEIGHT="26"></td>
</tr>
</table>
<p align="center">&nbsp;</p>
</body>

defanjos

5:50 pm on Dec 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I could be wrong, but I don't see within your form a field called "gsTotal".

Try adding to the hidden fields this:
<input type="hidden" name="gsTotal" value="<%=gsTotal%>">

then call it on the confirmation page like:
<%=Request.Form("gsTotal")%>

Bishop

4:32 pm on Jan 1, 2005 (gmt 0)

10+ Year Member



Thank defanjos, I'll give that a shot.