Forum Moderators: open
I have a piece of code that redirects users to a payment screen if their purchase is!= $0
It used to work, and I don't "think" I've modified it.
can someone have a look and see what's up.
if ( totamt!= "0.00" )
{ formchecked = true;
clientdetails = "Name:"+ thisform.businessname.value + "Phone:" + thisform.dayphone.value;
clientdetails = clientdetails.replace(/ /i,"_");
var URLQry = "http://www.example.com.au/response2.htm"+"?value=";
URLQry = URLQry + totamt + "name=" + clientdetails;
thisform.redirect.value=URLQry;
} else
{ thisform.redirect.value="http://www.example.com/response.htm";
}; basically it goes to the right place if the totamt = 0 but goes to some sort of default formmail "Thankyou" page if there is a value.
Any Ideas?
that redirects users to a payment screen if their purchase is!= $0
if ( totamt!= "0.00" )
$0, "0.00", and 0 are all three different values. :-) Logically they are not, but by quoting "0.00" it's possible it's seeing it as a string.
try testing it as a number
if (totamt > 0)
This should work for 0.00, 1, 1.55, or any actual number.
Unless you have the $ in totamt, which would complicate things.
So acn anyone see what's wrong with this piece of code?
formchecked = true;
clientdetails = "Name:"+ thisform.businessname.value + "Phone:" + thisform.dayphone.value;
clientdetails = clientdetails.replace(/ /i,"_");
var URLQry = "http://www.example.com.au/response2.htm"+"?value=";
URLQry = URLQry + totamt + "name=" + clientdetails;
thisform.redirect.value=URLQry;
Thanks
Kenton