Computer Programming web Web programming Tips

How to Pass Array Parameters to a Modeless Popup

By Sergey Skudaev

I show you how to create a modeless popup and pass $_GET parameters from a parent page to the popup page. I use PHP and JavaScript to make it possible. JavaScript modelessparam function creates a modeless popup. Then in the URL you pass parameters and read them in popup page.

This is a script for main page:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head> <title>Pass params to modeless popup</TITLE>


$param1="Hello There!";
$param2="Hi World!";

<script language="JavaScript" type="text/javascript">

function modelessparam(url,width,height){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog( url,"","help:0;resizable:1;dialogWidth:'+width+



<p align="center"><input type="button" name="greeting" value="Open Popup"
'http://yourdomain/popup/popup.php?param1=<? echo $param1;
? >&param2=<? echo $param2; ?>',300,200)"></p>



This is a script for popup page:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Popup with param from parent window</title>

$param1 =$_GET['param1'];

$param2 =$_GET['param2'];


<body bgcolor="#996699">

print('<p style="align:center; font-size:40px; color: #000;">'. $param1.'</p>');

print('<p style="align:center; font-size:50px; color: #000;">'.$param2.'</p>');


My eBooks on

Subscribe to our mail list to receive free code examples.


No comments yet.

Add Comment

* Required information
(never displayed)
Smile Sad Huh Laugh Mad Tongue Crying Grin Wink Scared Cool Sleep Blush Unsure Shocked
Enter the last letter of the word satellite.
Enter answer:
Enter code:
Notify me of new comments via email.
Remember my form inputs on this computer.
I have read and understand the privacy policy. *
I have read and agree to the terms and conditions. *
Powered by Commentics