On Tuesday, June 25, 2002, at 06:56 PM, Phillip S. Baker wrote:
> When the form is submitted I want to values passed to a pop-up window.
> I am aware of the need for Javascript for the pop-up window, but how do
> I get the values from the form passed to the new window so I can use
> them in further scripts.
> I can write the javascript to do the popup window and use the onSubmit
> command, but I cannot figure out how to pass the values with a regular
> submit button.
> Thanks
Pass them along the querystring, so that when the JavaScript popup
window opens and it goes to a certain page, those values are part of
that URL. As GET variables.
// Your PHP vars:
$var1 = 'Metroid';
$var2 = 'Metal Gear';
// Create a querystring:
$PHPqueryString = "var1=" . $var1 . "&var2=" . $var2;
// echo the browser string for the popup:
print "<a href=\"\" onclick=\"openPopup("
. $PHPqueryString
. "\">Popup!</a>\n";
// here's your JavaScript function
function openPopup(queryString)
{
var detailwindow = window.open('./target.php?' + queryString,
'windowname',
'toolbar=no,directories=no,
status=no,menubar=no,resizable=yes,
copyhistory=no,scrollbars=yes,
width=500,height=300');
detailwindow.moveTo('150', '150');
}
Now in your new script you can access these GET vars from PHP or from JS!
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php