Welcome to WebmasterWorld Guest from 54.167.0.111

Forum Moderators: open

Message Too Old, No Replies

Formmail redirect now not working

I'm sure it was befor, but not now

     

Kenton

11:02 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Hi

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?

rocknbil

11:12 pm on Nov 21, 2005 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.

Kenton

10:11 am on Nov 22, 2005 (gmt 0)

10+ Year Member



Hi,
That doesn't seem to be it.

It correctly goes to the else part on 0 but when it processes the "if" part it redirects to the default "Thank you" page.

Kenton

Kenton

10:35 pm on Nov 24, 2005 (gmt 0)

10+ Year Member



Hi

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