[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":

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.

last edited (March 31, 2003) by Souldrinker, Number of views: 2014, Current Rev: 3 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.