Solved

pop up windows

Posted on 2002-07-08
6
243 Views
Last Modified: 2013-11-28
Can pop up windows be done in PHP?  If so, how?
0
Comment
Question by:ironfingers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
axis_img earned 50 total points
ID: 7139630
No. PHP is processed on the server _BEFORE_ it is sent to the user. New browser windows have to be done with javascript. You can use PHP to print out the javascript for a popup window though, just in case you wanted something in the javascript to be dynamic. Something along the lines of:

<?
$file            = "page.html";
$width           = 500;
$height          = 400;

$js_string       = "<script language='javascript'>\n";
$js_string      .= "<!--\n";
$js_string      .= "var win = window.open('" . $file . "', 'newwin', 'width=" . $width . ",height=" . $height . "');\n";
$js_string      .= "//-->\n";
$js_string      .= "</script>\n";

print($js_string);
?>


Let me know if you have any other questions...
Barry
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7140441
Barry why you want do print those statements using PHP ?
I mean you can simply do,

<html>
<head>
<script language="javascript">
window.open("page.html",'windowname','width=300,height=300');
</script>
</html>

<?php
//your php code can go here.

?>

JD
0
 
LVL 7

Expert Comment

by:axis_img
ID: 7140907
Hi JD...

You don't have to use PHP for this at all. The question was "Can pop up windows be done in PHP?  If so, how?" The question as it is asked makes me assume that he knows HOW to open new windows in Javascript, and is asking if he can do it in PHP as well.

The answer is "No", which I stated. It seemed that ironfingers was asking this for a reason, so I am simply explaining to him that you can use PHP to print out the javascript code to do the new window. You obviously wouldn't use PHP to print out the simple javascript window.open example I gave, but it was simply for example purposes. It is meant to show that you can create dynamic javascript strings for your pages.

If I misunderstood, then I am sorry. You would obviously not use PHP to print out javascript all the time, but there are some cases where it is needed, which is what I was trying to show. I thought that was the question at hand.

Regards,
Barry
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7143119
Hm..yeah true.

I guess question was asking for clarification

JD
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP Curl Problem 10 68
JSON decode 5 42
Insert Event into Google Calendar using PHP and Google Calendar API 1 54
Conditional Array Element 7 23
In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
Online promotion is consistently becoming more important for all types of businesses. From Facebook ads to search engines to YouTube videos, there are all sorts of channels that can effectively be used to promote a business or product. But how shoul…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question