Welcome to WebmasterWorld Guest from 54.144.107.83

Forum Moderators: open

Message Too Old, No Replies

Formmail redirect now not working

I'm sure it was befor, but not now

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

Junior Member

10+ Year Member

joined:Nov 18, 2003
posts:77
votes: 0


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?

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

Senior Member

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

joined:Nov 28, 2004
posts:7999
votes: 0


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.

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

Junior Member

10+ Year Member

joined:Nov 18, 2003
posts:77
votes: 0


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

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

Junior Member

10+ Year Member

joined:Nov 18, 2003
posts:77
votes: 0


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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members