Forum Moderators: open
I was wondering if I need to have the active submit button outside of both forms and write a function that will submit both forms at the same time but only take it to the destination of one of the forms and ignore thr forward tag for the other.
This is also all written within a php page.
function PRICE() { if(document.REQUEST.DOMAINBOX.value == 0) {
var total = new Number(document.REQUEST.TOTAL.value);
document.PayPal.a1.value=total;
document.PayPal.a3.value=total;
document.PayPal.item_name.value="Website Hosting Service";
document.PayPal.item_number.value="00001";
}
else {
var total = new Number(document.REQUEST.TOTAL.value);
var dcost = new Number(35);
document.PayPal.a1.value=dcost+total;
document.PayPal.a3.value=total;
document.PayPal.item_name.value="Domain Webhosting Service";
document.PayPal.item_number.value="00002";
}
document.REQUEST.submit();
}
<form name="PayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onclick="PRICE();">
Do I need to write a seperate functiont that will submit both forms with the execution of the if else statement first.
I am stuck and have been working it on it for about 8hrs.
I'm not a javascript guru, but I believe theres a couple of ways to do this. You can either call another function from inside your function PRICE() ie once this function has run you include the other function inside the closing brace so they will run in sequence. The other way of doing it is in your form tag where you have OnSubmit= you can have multiple functions seperated by semi colons ie "PRICE(); SECONDFUNCTION();" you could add more to this is you wanted. If you wanted them to go to different destinations then you would have to change the action handler to do something like this.
myform1.action = 'destination1.asp/php'
myform1.submit()
myform2.action = 'destination2.asp/php'
myform2.submit()
Not sure how netscape will deal with the last bit but should work in IE
Hope this helps
Mark