I am trying to passing a calculated total to a
bank 'shopping cart'.
The variable we are passing is called charge_total.
Here is what we have in abstract
<HTML>
<HEAD><TITLE>PD Solutions - Order Form - Page 1</TITLE>
<link rel="stylesheet" type="text/css" href="franklin1style.css">
<!-- Original: Ville Leivo (ville...@welho.com ) -->
<!-- Web Site: http://koti.welho.com/vleivo -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<script type="text/javascript">
function load()
{
window.status = "Made by Ville Leivo 15.07.2002"
}
function count()
{
var item1price = 63.00;
var item2price = 63.00;
var item3price = 63.00;
var item4price = 63.00;
var item5price = 63.00;
var item6price = 63.00;
var item7price = 63.00;
var item8price = 63.00;
var item9price = 63.00;
var item10price = 63.00;
var item11price = 63.00;
var item12price = 63.00;
var item13price = 63.00;
var item14price = 63.00;
var item15price = 63.00;
var item16price = 63.00;
var item17price = 63.00;
var item18price = 63.00;
var item19price = 63.00;
var item20price = 63.00;
var item21price = 63.00;
var item22price = 63.00;
var item23price = 63.00;
var item24price = 63.00;
var item25price = 63.00;
var item26price = 63.00;
var item27price = 63.00;
var item28price = 63.00;
var item29price = 63.00;
var item30price = 63.00;
var item31price = 63.00;
var item32price = 63.00;
var item33price = 63.00;
var item34price = 63.00;
var item35price = 63.00;
var item36price = 63.00;
var item37price = 63.00;
var item38price = 63.00;
var item39price = 63.00;
var item40price = 63.00;
var item41price = 63.00;
var item42price = 63.00;
var item43price = 63.00;
var item44price = 63.00;
var item45price = 63.00;
var item46price = 63.00;
var item47price = 63.00;
var item48price = 63.00;
var item49price = 63.00;
var item50price = 63.00;
var item51price = 63.00;
var item52price = 63.00;
var item53price = 63.00;
var item54price = 63.00;
var item55price = 63.00;
var item56price = 63.00;
var item57price = 63.00;
var item58price = 63.00;
var item59price = 63.00;
var item60price = 63.00;
var item61price = 63.00;
var item62price = 63.00;
var item63price = 63.00;
var item64price = 63.00;
var item65price = 63.00;
var item66price = 63.00;
var item67price = 63.00;
var item68price = 63.00;
var item69price = 63.00;
var item70price = 63.00;
var item71price = 63.00;
// kortti
if (calc.item1.checked){
var witem1 = document.calc.item1.value = item1price;
} else {
var witem1 = document.calc.item1.value = 0;
}
if (calc.item2.checked){
var witem2 = document.calc.item2.value = item2price;
} else {
var witem2 = document.calc.item2.value = 0;
}
// www-sivut
if (calc.item3.checked) {
var witem3 = document.calc.item3.value = item3price;
} else {
var witem3 = document.calc.item3.value = 0;
}
if (calc.item4.checked) {
var witem4 = document.calc.item4.value = item4price;
} else {
var witem4 = document.calc.item4.value = 0;
}
if (calc.item5.checked) {
var witem5 = document.calc.item5.value = item5price;
} else {
var witem5 = document.calc.item5.value = 0;
}
if (calc.item6.checked) {
var witem6 = document.calc.item6.value = item6price;
} else {
var witem6 = document.calc.item6.value = 0;
}
if (calc.item7.checked) {
var witem7 = document.calc.item7.value = item7price;
} else {
var witem7 = document.calc.item7.value = 0;
}
if (calc.item8.checked) {
var witem8 = document.calc.item8.value = item8price;
} else {
var witem8 = document.calc.item8.value = 0;
}
if (calc.item9.checked) {
var witem9 = document.calc.item9.value = item9price;
} else {
var witem9 = document.calc.item9.value = 0;
}
if (calc.item10.checked) {
var witem10 = document.calc.item10.value = item10price;
} else {
var witem10 = document.calc.item10.value = 0;
}
if (calc.item11.checked) {
var witem11 = document.calc.item11.value = item11price;
} else {
var witem11 = document.calc.item11.value = 0;
}
if (calc.item12.checked) {
var witem12 = document.calc.item12.value = item12price;
} else {
var witem12 = document.calc.item12.value = 0;
}
if (calc.item13.checked) {
var witem13 = document.calc.item13.value = item13price;
} else {
var witem13 = document.calc.item13.value = 0;
}
if (calc.item14.checked) {
var witem14 = document.calc.item14.value = item14price;
} else {
var witem14 = document.calc.item14.value = 0;
}
if (calc.item15.checked) {
var witem15 = document.calc.item15.value = item15price;
} else {
var witem15 = document.calc.item15.value = 0;
}
if (calc.item16.checked) {
var witem16 = document.calc.item16.value = item16price;
} else {
var witem16 = document.calc.item16.value = 0;
}
if (calc.item17.checked) {
var witem17 = document.calc.item17.value = item17price;
} else {
var witem17 = document.calc.item17.value = 0;
}
if (calc.item18.checked) {
var witem18 = document.calc.item18.value = item18price;
} else {
var witem18 = document.calc.item18.value = 0;
}
if (calc.item19.checked) {
var witem19 = document.calc.item19.value = item19price;
} else {
var witem19 = document.calc.item19.value = 0;
}
if (calc.item20.checked) {
var witem20 = document.calc.item20.value = item20price;
} else {
var witem20 = document.calc.item20.value = 0;
}
if (calc.item21.checked) {
var witem21 = document.calc.item21.value = item21price;
} else {
var witem21 = document.calc.item21.value = 0;
}
if (calc.item22.checked) {
var witem22 = document.calc.item22.value = item22price;
} else {
var witem22 = document.calc.item22.value = 0;
}
if (calc.item23.checked) {
var witem23 = document.calc.item23.value = item23price;
} else {
var witem23 = document.calc.item23.value = 0;
}
if (calc.item24.checked) {
var witem24 = document.calc.item24.value = item24price;
} else {
var witem24 = document.calc.item24.value = 0;
}
if (calc.item25.checked) {
var witem25 = document.calc.item25.value = item25price;
} else {
var witem25 = document.calc.item25.value = 0;
}
if (calc.item26.checked) {
var witem26 = document.calc.item26.value = item26price;
} else {
var witem26 = document.calc.item26.value = 0;
}
if (calc.item27.checked) {
var witem27 = document.calc.item27.value = item27price;
} else {
var witem27 = document.calc.item27.value = 0;
}
if (calc.item28.checked) {
var witem28 = document.calc.item28.value = item28price;
} else {
var witem28 = document.calc.item28.value = 0;
}
if (calc.item29.checked) {
var witem29 = document.calc.item29.value = item29price;
} else {
var witem29 = document.calc.item29.value = 0;
}
if (calc.item30.checked) {
var witem30 = document.calc.item30.value = item30price;
} else {
var witem30 = document.calc.item30.value = 0;
}
if (calc.item31.checked) {
var witem31 = document.calc.item31.value = item31price;
} else {
var witem31 = document.calc.item31.value = 0;
}
if (calc.item32.checked) {
var witem32 = document.calc.item32.value = item32price;
} else {
var witem32 = document.calc.item32.value = 0;
}
if (calc.item33.checked) {
var witem33 = document.calc.item33.value = item33price;
} else {
var witem33 = document.calc.item33.value = 0;
}
if (calc.item34.checked) {
var witem34 = document.calc.item34.value = item34price;
} else {
var witem34 = document.calc.item34.value = 0;
}
if (calc.item35.checked) {
var witem35 = document.calc.item35.value = item35price;
} else {
var witem35 = document.calc.item35.value = 0;
}
if (calc.item36.checked) {
var witem36 = document.calc.item36.value = item36price;
} else {
var witem36 = document.calc.item36.value = 0;
}
if (calc.item37.checked) {
var witem37 = document.calc.item37.value = item37price;
} else {
var witem37 = document.calc.item37.value = 0;
}
if (calc.item38.checked) {
var witem38 = document.calc.item38.value = item38price;
} else {
var witem38 = document.calc.item38.value = 0;
}
if (calc.item39.checked) {
var witem39 = document.calc.item39.value = item39price;
} else {
var witem39 = document.calc.item39.value = 0;
}
if (calc.item40.checked) {
var witem40 = document.calc.item40.value = item40price;
} else {
var witem40 = document.calc.item40.value = 0;
}
if (calc.item41.checked) {
var witem41 = document.calc.item41.value = item41price;
} else {
var witem41 = document.calc.item41.value = 0;
}
if (calc.item42.checked) {
var witem42 = document.calc.item42.value = item42price;
} else {
var witem42 = document.calc.item42.value = 0;
}
if (calc.item43.checked) {
var witem43 = document.calc.item43.value = item43price;
} else {
var witem43 = document.calc.item43.value = 0;
}
if (calc.item44.checked) {
var witem44 = document.calc.item44.value = item44price;
} else {
var witem44 = document.calc.item44.value = 0;
}
if (calc.item45.checked) {
var witem45 = document.calc.item45.value = item45price;
} else {
var witem45 = document.calc.item45.value = 0;
}
if (calc.item46.checked) {
var witem46 = document.calc.item46.value = item46price;
} else {
var witem46 = document.calc.item46.value = 0;
}
if (calc.item47.checked) {
var witem47 = document.calc.item47.value = item47price;
} else {
var witem47 = document.calc.item47.value = 0;
}
if (calc.item48.checked) {
var witem48 = document.calc.item48.value = item48price;
} else {
var witem48 = document.calc.item48.value = 0;
}
if (calc.item49.checked) {
var witem49 = document.calc.item49.value = item49price;
} else {
var witem49 = document.calc.item49.value = 0;
}
if (calc.item50.checked) {
var witem50 = document.calc.item50.value = item50price;
} else {
var witem50 = document.calc.item50.value = 0;
}
if (calc.item51.checked) {
var witem51 = document.calc.item51.value = item51price;
} else {
var witem51 = document.calc.item51.value = 0;
}
if (calc.item52.checked) {
var witem52 = document.calc.item52.value = item52price;
} else {
var witem52 = document.calc.item52.value = 0;
}
if (calc.item53.checked) {
var witem53 = document.calc.item53.value = item53price;
} else {
var witem53 = document.calc.item53.value = 0;
}
if (calc.item54.checked) {
var witem54 = document.calc.item54.value = item54price;
} else {
var witem54 = document.calc.item54.value = 0;
}
if (calc.item55.checked) {
var witem55 = document.calc.item55.value = item55price;
} else {
var witem55 = document.calc.item55.value = 0;
}
if (calc.item56.checked) {
var witem56 = document.calc.item56.value = item56price;
} else {
var witem56 = document.calc.item56.value = 0;
}
if (calc.item57.checked) {
var witem57 = document.calc.item57.value = item57price;
} else {
var witem57 = document.calc.item57.value = 0;
}
if (calc.item58.checked) {
var witem58 = document.calc.item58.value = item58price;
} else {
var witem58 = document.calc.item58.value = 0;
}
if (calc.item59.checked) {
var witem59 = document.calc.item59.value = item59price;
} else {
var witem59 = document.calc.item59.value = 0;
}
if (calc.item60.checked) {
var witem60 = document.calc.item60.value = item60price;
} else {
var witem60 = document.calc.item60.value = 0;
}
if (calc.item61.checked) {
var witem61 = document.calc.item61.value = item61price;
} else {
var witem61 = document.calc.item61.value = 0;
}
if (calc.item62.checked) {
var witem62 = document.calc.item62.value = item62price;
} else {
var witem62 = document.calc.item62.value = 0;
}
if (calc.item63.checked) {
var witem63 = document.calc.item63.value = item63price;
} else {
var witem63 = document.calc.item63.value = 0;
}
if (calc.item64.checked) {
var witem64 = document.calc.item64.value = item64price;
} else {
var witem64 = document.calc.item64.value = 0;
}
if (calc.item65.checked) {
var witem65 = document.calc.item65.value = item65price;
} else {
var witem65 = document.calc.item65.value = 0;
}
if (calc.item66.checked) {
var witem66 = document.calc.item66.value = item66price;
} else {
var witem66 = document.calc.item66.value = 0;
}
if (calc.item67.checked) {
var witem67 = document.calc.item67.value = item67price;
} else {
var witem67 = document.calc.item67.value = 0;
}
if (calc.item68.checked) {
var witem68 = document.calc.item68.value = item68price;
} else {
var witem68 = document.calc.item68.value = 0;
}
if (calc.item69.checked) {
var witem69 = document.calc.item69.value = item69price;
} else {
var witem69 = document.calc.item69.value = 0;
}
if (calc.item70.checked) {
var witem70 = document.calc.item70.value = item70price;
} else {
var witem70 = document.calc.item70.value = 0;
}
if (calc.item71.checked) {
var witem71 = document.calc.item71.value = item71price;
} else {
var witem71 = document.calc.item71.value = 0;
}
document.calc.pay.value = (witem1 + witem2 + witem3 + witem4 + witem5 + witem6 + witem7 + witem8 + witem9 + witem10 + witem11 + witem12 + witem13 + witem14 + witem15 + witem16 + witem17 + witem18 + witem19 + witem20 + witem21 + witem22 + witem23 + witem24 + witem25 + witem26 + witem27 + witem28 + witem29 + witem30 + witem31 + witem32 + witem33 +witem34 + witem35 + witem36 + witem37 + witem38 + witem39 + witem40 + witem41 + witem42 + witem43 + witem44 + witem45 + witem46 + witem47 + witem48 + witem49 + witem50 + witem51 + witem52 + witem53 + witem54 + witem55 + witem56 + witem57 + witem58 + witem59 + witem60 + witem61 + witem62 + witem63 + witem64 + witem65 + witem66 + witem67 + witem68 + witem69 + witem70 + witem71) + ".00" ;
return document.calc.pay.value
}
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#FF0000 ALINK=#FF0000 onLoad="load()">
....
<form action="https://esqa.moneris.com/HPPDP/index.php" method="post" name="calc" onSubmit="return count();">
<input type="hidden" name="ps_store_id" value="CL535tore1">
<input type="hidden" name="hpp_key" value="hpYHLXQ5G6BY">
<input type="hidden" name="charge_total" class=" ">
<input type="hidden" name="rvar_subject" value="PD Solutions Order Form">
<input type="hidden" name="rvar_recipients" value="tga...@pdsolutions.ca">
<input type="hidden" name="rvar_required" value="realname,email">
<input type="hidden" name="rvar_mail_options" value="NoEmpty">
<input type="hidden" name="rvar_title" value="PD Solutions Order">
<input type="hidden" name="rvar_cc_visitor" value="1">
<input type="hidden" name="rvar_bad_url" value="https://secure.nl2k.ab.ca/pdsolutions/">
<INPUT TYPE="HIDDEN" NAME="rvar_env_report" VALUE="REMOTE_HOST,REMOTE_ADDR">
<TABLE border=0 cellpadding=0 cellspacing=0 width=90%>
<tr bgcolor=#EBEBEB>
<td align=center><font face="Arial,Helvetica" size=2 color=black><strong>Item</strong></td><td> </td>
<td align=center><font face="Arial,Helvetica" size=2 color=black><strong>Date & Time</strong></td>
<td align=center><font face="Arial,Helvetica" size=2 color=black><strong>Quantity</strong></td>
<td align=center><font face="Arial,Helvetica" size=2 color=black><strong>Price</strong></td>
</tr>
<tr>
<td align=left><font face="Arial,Helvetica" size=2>Pest Control Products Act</td></a><td> </td>
<td align=left><font face="Arial,Helvetica" size=2>October 27-2008 12.00 Noon</td>
<td align=left><input type="checkbox" name="item1"></td>
<td align=right><font face="Arial,Helvetica" size=2>$60.00</td></tr>
...
<td bgcolor="#cccccc" colspan="2" align="right"><span class="normalText">Price $</span><input type="text" name="pay" size="10" style="background-color:#ffffff; color:#000000; border:1px solid #000000; font-family:tahoma; font-size:8pt; letter-spacing=1px"></td>
<tr>
<td bgcolor="#eeeeee" align="center"></td>
<td bgcolor="#eeeeee" align="right"><input type="button" onClick="count()" value="Calculate" style="background-color:#ffffff; color:#000000; border:1px solid #000000; font-family:tahoma; font-size:8pt; letter-spacing=1px"> <input type="reset" value="Reset" style="background-color:#ffffff; color:#000000; border:1px solid #000000; font-family:tahoma; font-size:8pt; letter-spacing=1px"></td>
</tr>
</TABLE>
<font size=3>
<input type=submit value="Place Your Order">
<input type=reset value="Clear the Form">
</FORM>
<!-- Bottom of page navigation here -->
<P>
<hr nosize=4 width=75%><P>
<table border=0 cellpadding=0 cellspacing=0 width=90%><tr>
<td bgcolor=#EBEBEB><font face="Arial,Helvetica" size=2 color=black>
Copyright © <font color=blue><strong><i>
PD Solutions.</i></strong><font color=black> All rights reserved. 2008
</td></tr></table>
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
</CENTER>
</BODY>
</HTML>
Source https://secure.nl2k.ab.ca/pdsolutions/test.html .
What do I need to pass the correct value to
https://secure.nl2k.ab.ca/pdsolutions/test.html .
--
Member - Liberal International
This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca
God, Queen and country! Beware Anti-Christ rising!
USA! Hold a referendum on your country and vote to be annexed by Canada.
A quandary? Hardly.
> I am trying to passing a calculated total to a
> bank 'shopping cart'.
>
> The variable we are passing is called charge_total.
[snip]
>
> What do I need to pass the correct value to
> https://secure.nl2k.ab.ca/pdsolutions/test.html .
I would think that you'd address this question to the bank whose page
you are submitting the information to.
> Right I have a interesting quandry.
>
> I am trying to passing a calculated total to a
> bank 'shopping cart'.
>
> The variable we are passing is called charge_total.
>
> Here is what we have in abstract
>
<snip>
><script type="text/javascript">
Please understand that
1. For users with javascript disabled, this will not work.
2. That's a LOT of text that has to be downloaded to the user's system.
> function load()
> {
> window.status = "Made by Ville Leivo 15.07.2002"
> }
Are you Ville Leivo, and if you are not, why would you want the user's
status bar to display this? Of course, my browser is configured to not
display this kind of nonsense.
Changing the window.status is a classic method for phishing. Are you a
phisher?
<snip>
>
><BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#FF0000
>ALINK=#FF0000 onLoad="load()">
This is very old style markup. Use CSS instead.
> Source https://secure.nl2k.ab.ca/pdsolutions/test.html .
>
> What do I need to pass the correct value to
> https://secure.nl2k.ab.ca/pdsolutions/test.html .
You would be better off doing this server side.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
No, don't tell him that, he's probably got my bank/account in mind.
However, if he's interested in making deposits, the sort code is
30-19-73 and the account number is 06355983 :-)
Numbers courtesy of REXX random() function.
--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Make your life easier and use a JS library. I like JQuery, but any
library can do this easily enough.
Quick sample, though the caveats that this will do nothing for users
with JS disabled
-----------------
<html>
<head>
<title>Test</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">
</script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
// trigger function when form with ID=myForm is submitted
$("#myForm").submit(function() {
var setChargeTotal = 0;
// loop through every element with a class=addToTotal this has
// the 'checked' attribute set as on
$(".addToTotal:checked").each(function () {
// add the value of the checked input to
// a variable called setChargeTotal
setChargeTotal = setChargeTotal + parseInt($(this).val());
});
// set value of input tag with name=charge_total
// to the setChargeTotal variable
$("input[name=charge_total]").val(setChargeTotal);
// send in the form
return true;
});
});
</script>
</head>
<body>
<input type="checkbox" name="rvar_item1" class="addToTotal"
value="63.00"> Product a<br>
<input type="checkbox" name="rvar_item2" class="addToTotal"
value="63.00"> Product b<br>
<input type="checkbox" name="rvar_item3" class="addToTotal"
value="63.00"> Product c<br>
and so on ....<br><br>
<form id="myForm" action="...wherever...">
<input type="hidden" name="charge_total" value="">
<input type=submit value="Place Your Order">
</form>
</body>
</html>
I also need once the rvar_item[n] is checked
that the item description is passed ot the shopping cart as well.
Put the price in an 'alt' attribute for the checkbox (don't know if that
will pass on HTML validator services -- I usually don't care if my
markup does). Switch the script to add the alt value. Set the value of
the checkbox as the name of the product -- only checked ones will pass on.
Assuming you have a PHP-capable server, try running the code below:
--------------
<html>
<head>
<title>Test...</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
// trigger when form with ID=myForm is submitted
$("#myForm").submit(function() {
var setChargeTotal = 0;
// loop through every element with a class=addToTotal
//this has the 'checked' attribute set as pn
$(".addToTotal:checked").each(function () {
// add the value in the alt of the checked input
// to a variable to setChargeTotal
setChargeTotal = setChargeTotal + parseInt($(this).attr("alt"));
});
// set every input tag with name = charge_total = the
// setChargeTotal variable
$("input[name=charge_total]").val(setChargeTotal);
// send in the form
return true;
});
});
</script>
</head>
<body>
<form id="myForm" action="<?PHP echo $_SERVER["PHP_SELF"];?>" method="POST">
<input type="checkbox" name="rvar_item[]" class="addToTotal" alt="63.00"
value="Product a"> Product a<br>
<input type="checkbox" name="rvar_item[]" class="addToTotal" alt="63.00"
value="Product b"> Product b<br>
<input type="checkbox" name="rvar_item[]" class="addToTotal" alt="63.00"
value="Product c"> Product c<br>
<input type="hidden" name="charge_total" value="">
<input type=submit value="Place Your Order">
</form>
<pre>
<?PHP
if($_POST) {
print_r($_POST);
}
?>
</pre>
</body>
</html>