Page 1 of 1

Javascript (window.open) with a PHP Variable

Posted: Thu Feb 26, 2004 12:16 pm
by THEMADGEEK
I am attempting to open a new window using javascript while passing a PHP variable to that window. I've tried several different ways to no avail.

Here is my latest try...

Code: Select all

<script language="JavaScript" type="text/javascript">
<!--
function popUpCenteredWindow() &#123;
    var win2;	
//opens a new window with no menubar or resize ability.
var win2 = window.open("edit_game2.php?id=<?=$phpvar?>",
"Window2","height=120,width=530,menubar=no,resizable=no,scrollbars=no,status=no");
	win2.focus();
&#125;
//-->
</script>
Can this be done?

Posted: Thu Feb 26, 2004 12:52 pm
by xisle
seems to work ok when you do it like this..

Code: Select all

<script language="JavaScript" type="text/javascript"> 
<!-- 
function popUpCenteredWindow() &#123; 
	var win2;    
//opens a new window with no menubar or resize ability. 
var win2 = window.open("phpinfo.php?self=<? echo $PHP_SELF; ?>", 
"Window2","height=120,width=530,menubar=no,resizable=no,scrollbars=no,status=no"); 
   win2.focus(); 
&#125;
//--> 
</script>