Javascript (window.open) with a PHP Variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
THEMADGEEK
Forum Newbie
Posts: 21
Joined: Thu Oct 30, 2003 6:04 pm

Javascript (window.open) with a PHP Variable

Post 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?
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post 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>
Post Reply