[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
FormsSendJS1
Back to Web Development FAQ Main Page.
To send information a user has given in a formular to different URLs, you have to use javascript. The following example shows how tho submit a form named "testform" to the page "results.php" or to the page "results2.php":
This is a helpful script if you have formulars that can not be filled out with one step - so the user has to send information befor he can fill out some fields of the formular.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
FormsSendJS1
Back to Web Development FAQ Main Page.
To send information a user has given in a formular to different URLs, you have to use javascript. The following example shows how tho submit a form named "testform" to the page "results.php" or to the page "results2.php":
HTML:
<form name="testform" action="" method="post">
<input type=text name="textfield">
<input type=button onClick="send(1);">
<input type=button onClick="send(2);">
</form>
JAVASCRIPT:
<SCRIPT LANGUAGE="JavaScript">
<!--
var ways = new Array();
ways[1] = "results.php";
ways[2] = "results2.php";
function send( way ) {
document.forms['testform'].action=ways[way];
document.forms['testform'].submit();
}
-->
</SCRIPT>
This is a helpful script if you have formulars that can not be filled out with one step - so the user has to send information befor he can fill out some fields of the formular.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
