J
JCCDevel
Hi All,
I'm trying to do something I thought would be simple (of course!)
1) ON a php page, calculate fees based upon user entires. I'm
calculating it in a javascript function and that is working well(based
upun using alerts to view values). However, I need to take that
calculated amount and pass it to a new page on redirect. This is the
calc function which seems to be working ok:
<code>
<script language="JavaScript">
function calc(fees){
var Discount = 0.90;
var WitnessCity1Loc = document.form1.WitnessCity1.value;
var Witness1Fee = 0;
var WitnessCity2Loc = document.form1.WitnessCity2.value;
var Witness2Fee = 0;
var WitnessCity3Loc = document.form1.WitnessCity3.value;
var Witness3Fee = 0 ;
var WitnessCity4Loc = document.form1.WitnessCity4.value;
var Witness4Fee = 0 ;
var FeeCalcTotal ;
if (WitnessCity1Loc == "Lowell")
{
Witness1Fee = 50;
}
else
{
Witness1Fee = 55;
}
if (WitnessCity2Loc != ""){
if (WitnessCity2Loc == "Lowell")
{
Witness2Fee = 50;
}
else
{
Witness2Fee = 55;
}
}
if (WitnessCity3Loc != ""){
if (WitnessCity3Loc == "Lowell")
{
Witness3Fee = 50;
}
else
{
Witness3Fee = 55;
}
}
if (WitnessCity4Loc != ""){
if (WitnessCity4Loc == "Lowell")
{
Witness4Fee = 50;
}
else
{
Witness4Fee = 55;
}
}
FeeCalcTotal = (Witness1Fee + Witness2Fee + Witness3Fee +
Witness4Fee)* Discount;
document.form1.chargetotal.value = FeeCalcTotal
</code>
Two things are supposed to happen when the submit button is pressed.
First, this happens:
<code>
<form name="form1" method="post" action="/cgi/formmail">
</code>
and then this is supposed to happen:
<code>
<input type="hidden" name="redirect" value="http://www.pagename.com/v3/
payment_pg.php?FeeCalcTotal=" & chargetotal& " " >
</code>
The post and the redirect are working but I just cannot seem to get
the calculated value passed on to the next page. Am I doing this
correctly? I'm used to doing this sort of thing on web pages that live
on our own servers - this is for somebody's individual website.
Just in case the info above is fuzzy, here's what I need in words and
not code!
When the customer clicks submit, three things should happen:
1) javascript calculation is performed (working)
2) calculation is stored in a hidden variable (might be working)
3) there is a method post to /cgi/formmail
4) there is a redirect to payment_pg.php page. The javascript
calculation amount needs to be carried over to this page somehow
Thanks in advance for any help you can give!
JCC
I'm trying to do something I thought would be simple (of course!)
1) ON a php page, calculate fees based upon user entires. I'm
calculating it in a javascript function and that is working well(based
upun using alerts to view values). However, I need to take that
calculated amount and pass it to a new page on redirect. This is the
calc function which seems to be working ok:
<code>
<script language="JavaScript">
function calc(fees){
var Discount = 0.90;
var WitnessCity1Loc = document.form1.WitnessCity1.value;
var Witness1Fee = 0;
var WitnessCity2Loc = document.form1.WitnessCity2.value;
var Witness2Fee = 0;
var WitnessCity3Loc = document.form1.WitnessCity3.value;
var Witness3Fee = 0 ;
var WitnessCity4Loc = document.form1.WitnessCity4.value;
var Witness4Fee = 0 ;
var FeeCalcTotal ;
if (WitnessCity1Loc == "Lowell")
{
Witness1Fee = 50;
}
else
{
Witness1Fee = 55;
}
if (WitnessCity2Loc != ""){
if (WitnessCity2Loc == "Lowell")
{
Witness2Fee = 50;
}
else
{
Witness2Fee = 55;
}
}
if (WitnessCity3Loc != ""){
if (WitnessCity3Loc == "Lowell")
{
Witness3Fee = 50;
}
else
{
Witness3Fee = 55;
}
}
if (WitnessCity4Loc != ""){
if (WitnessCity4Loc == "Lowell")
{
Witness4Fee = 50;
}
else
{
Witness4Fee = 55;
}
}
FeeCalcTotal = (Witness1Fee + Witness2Fee + Witness3Fee +
Witness4Fee)* Discount;
document.form1.chargetotal.value = FeeCalcTotal
</code>
Two things are supposed to happen when the submit button is pressed.
First, this happens:
<code>
<form name="form1" method="post" action="/cgi/formmail">
</code>
and then this is supposed to happen:
<code>
<input type="hidden" name="redirect" value="http://www.pagename.com/v3/
payment_pg.php?FeeCalcTotal=" & chargetotal& " " >
</code>
The post and the redirect are working but I just cannot seem to get
the calculated value passed on to the next page. Am I doing this
correctly? I'm used to doing this sort of thing on web pages that live
on our own servers - this is for somebody's individual website.
Just in case the info above is fuzzy, here's what I need in words and
not code!
When the customer clicks submit, three things should happen:
1) javascript calculation is performed (working)
2) calculation is stored in a hidden variable (might be working)
3) there is a method post to /cgi/formmail
4) there is a redirect to payment_pg.php page. The javascript
calculation amount needs to be carried over to this page somehow
Thanks in advance for any help you can give!
JCC