margarit
asked on
"Submit" pass parameters to 2 diffrent targets
Hello,
I have an HTML page with form on it. Form includes: text fields and 2 buttons.
If I click on button1 -> Another page2.html opens with form on it. And page2.html should get parameters from form1.
If I click on button2 -> I want to submit all the parameters from page1 to my server.
My question: how to define form action: should it be:
<form method="get" action="http://page2.html"">
or
<form method="get" action="http://167.1.1.7/cgi-bin/start">
Should the action be page2 adress or server adress?
THANKS
Margarit
I have an HTML page with form on it. Form includes: text fields and 2 buttons.
If I click on button1 -> Another page2.html opens with form on it. And page2.html should get parameters from form1.
If I click on button2 -> I want to submit all the parameters from page1 to my server.
My question: how to define form action: should it be:
<form method="get" action="http://page2.html"">
or
<form method="get" action="http://167.1.1.7/cgi-bin/start">
Should the action be page2 adress or server adress?
THANKS
Margarit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
I am trying it now.
The problem is:
When I click button: "SendToPage2" I need it to submit params to page2 and navigate to page2.html as well.
But when I click button "SendToServer" the navigation is done from cgi file.
Margarit
I am trying it now.
The problem is:
When I click button: "SendToPage2" I need it to submit params to page2 and navigate to page2.html as well.
But when I click button "SendToServer" the navigation is done from cgi file.
Margarit
I didn't understand... When you click the buttons now, what is happening? Because it should send you to the corresponding page.
By the way, the code has a little typo, the name of the form is myForm with uppercase "F", and in function sendIt() I writed myform, with lowercase "f". So, the correct code should be:
By the way, the code has a little typo, the name of the form is myForm with uppercase "F", and in function sendIt() I writed myform, with lowercase "f". So, the correct code should be:
<script language=javascript>
function sendIt(actionURL) {
document.myForm.action = actionURL;
document.myForm.submit();
}
</script>
<form name="myForm" method="get" action="">
<input type=button name="SendToPage2" value="Send To Page2" onClick="sendIt('http://page2.html');">
<input type=button name="SendToServer" value="Send To Server" onClick="sendIt('http://167.1.1.7/cgi-bin/start');">
</form>
ASKER
Hi,
It was my mistake.
It works fine!!! THANKS a lot!!!
Margarit
It was my mistake.
It works fine!!! THANKS a lot!!!
Margarit
ASKER
I will try it now.