How to Pass $_GET Parameters to a Modeless Popup
![]()
![]()
![]()
![]()
![]()
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:
parent.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pass params to modeless popup</TITLE>
<?php
$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+
'px;dialogHeight:'+height+'px")')
else
eval('window.open(url,"","width='+width+'px,height=
'+height+'px,resizable=1,scrollbars=1")')
}
</script>
</head>
<body>
<p align="center"><input type="button" name="greeting" value="Open Popup"
onClick="javascript:modelessparam(
'http://yourdomain/popup/popup.php?param1=<? echo $param1;
? >¶m2=<? echo $param2; ?>',300,200)"></p>
</form>
</body>
</html>
This is a script for popup page:
popup.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Popup with param from parent window</title>
<?
if(isset($_GET['param1']))
$param1 =$_GET['param1'];
if(isset($_GET['param2']))
$param2 =$_GET['param2'];
?>
</head>
<body bgcolor="#996699">
<?php
print('<p style="align:center; font-size:40px; color: #000;">'. $param1.'</p>');
print('<p style="align:center; font-size:50px; color: #000;">'.$param2.'</p>');
?>
</body>
</html>
- =
Please rate the tutorial
Learn SQL Programming By Examples [Kindle Edition]2.99
Learn PHP Programming by Examples [Kindle Edition] $2.99
Learn Visual Basic 6.0 [Kindle Edition] $1.99
How to Build Your Own Web Site from Scratch [Kindle Edition] $1.49
New-trip.com website source code
| Comments | |
|---|---|
- Home
- modeless_popup
- Batch Files
- Java Properties
- Form Validation
- Display Image PHP
- Upload File PHP
- phpMyAdmin
- Environment Variables
- Delete Trojan horse
- PHP Code Examples
- Learn PHP
- Modeless Popup
- Read Screen Resolution
- PHP Class Example
- Page View Counter
- Display Any Table
- Read csv file
- PHP Array Functions
- Array of Fields
- GET mess
- Array of Check boxes
- PHP and MS Access
- User_Auth. Demo
- PHP App Example
- PHP + Oracle 1
- PHP + Oracle 2
- Image Collection
- Create Gallery
- Block Spam Post
- $_REQUEST,$_SESSION
- Headers Allredy Sent
- Virtual Server
- Apache:OS 10048
- Set Shopping Cart
- My Best CSS Layout
- Database Design
- Password Keeper
- MySQL and Excel
- Learn MySQL
- Learn SQL
- Learn C++
- Learn Java
- Learn Visual Basic
- Web Site Tips
- Site map
- Registration
Web programming Tips