Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

pop up windows

Posted on 2002-07-08
6
Medium Priority
?
248 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to dynamically set the form action using jQuery.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

721 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