Re: How pass form variable to window.open()

From: Date: Thu, 05 Aug 2004 16:02:21 +0000
Subject: Re: How pass form variable to window.open()
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-192888@lists.php.net to get a copy of this message
Actually, I just did this last night with great success. Here is my code, I'm sure you can adapt it to your own. PHP was not needed, this was all done as part of the client-side validation JavaScript. Use JavaScript in the submit button's onClick to set the JavaScript variable with the value from the form field (I have a form field called "z" that is getting passed along as a GET request with the window.open href): <script type="text/javascript" language="javascript"> <!-- function validate(myForm) { ...a bunch of other unrelated stuff here... window.open('http://www.mysite.com/tool.php?z='+ myForm.z.value+'&loc='+location.href,'','toolbar=0,location=0,directories=0,status=0,me nubar=0,scrollbars=0,resizable=yes,height=400,width=400',true); } //--> </script> <form name="myForm"> <input name="z" type="text"> <input type="submit" value="Submit" onClick="return validate(myForm);"> </form> Hope this helps. :) - Brian

« previous php.general (#192888) next »