Link to home
Start Free TrialLog in
Avatar of margarit
margaritFlag for Israel

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
ASKER CERTIFIED SOLUTION
Avatar of xBellox
xBellox

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of margarit

ASKER

THANKS for the fast reply!!!!
I will try it now.
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
Avatar of xBellox
xBellox

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:

<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>

Open in new window

Hi,
It was my mistake.
It works fine!!! THANKS a lot!!!
Margarit