Jump to content

Send Variables with Pop-up


lunny

Recommended Posts

First off I would like to create a pop-up, and with this send 2 variables which are needed for the functions in the pop-up. I dont want to use session since I want for example 6 different links on a page to the pop-up each time displaying different information in the pop-up based on the variables passed.

 

Also I started with just creating pop-ups :

 

function OpenWindow(URL)

{

var MyPopupWindow = window.open(URL);

}

 

and

 

<a href="javascript:OpenWindow('http://x');">Using a Custom Javascript Function</a>

 

But keep getting object expected error

 

 

Link to comment
https://forums.phpfreaks.com/topic/49423-send-variables-with-pop-up/
Share on other sites

Ok next problem..

 

On this pop-up I was able to read in the variables from the URL np, thanks a lot for that. The problem is i want to use these variables in the Onload method which is set in body.

 

So I tried

 

<body onload="load(<?php $_GET['long'];?>, <?php $_GET['late'];?>)" >

 

But isnt working as when I just put the numbers in, any ideas ?

Just in case you want to use this:

Main Page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
<script type="text/javascript">
function myPopup(url, width, height) {
window.open(url, 'MyPopUp', width, height);
}
</script>
</head>

<body>
<form target="MyPopUp" action="popup.php" name="myForm">
<input type="text" name="myText" /><br />
<input type="submit" value="Submit" name="process" onclick="myPopup('popup.php', '400', '400');" />
</form>
</body>
</html>

 

popup.php :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Pop-Up</title>
<?php
$myText = $_REQUEST['myText'];
$process = $_REQUEST['process'];
if($myText == "" || !isset($myText)) {
$close = 1;
}else{
$myString = $myText . "<br />\r\n";
}
?>
</head>

<body <?php if($close == 1) { print " onload=\"self.close();\""; } ?>>
<?php
echo $myString;
?>
</body>
</html>

 

;D Woody

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.