Page 1 of 1

Popup window with PHP?

Posted: Thu Aug 26, 2004 8:00 am
by hvlav79
Hi guys. I need some help writing a code that will open a popup window automatically, as soon as a function is completed. I want to write it in PHP without using javascript. Is that possible? If not, how would I write it using javascript?
Thanks in advance!

Posted: Thu Aug 26, 2004 8:11 am
by Bill H
PHP is server side, while popups are client side, so you need javascript.
Within the <head> tag:

Code: Select all

<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
     function firstWindow(report,winht,winwth)
     &#123;
          var windowX = (screen.width/2)-(winwth/2);
          s = "top=170,left="+windowX+",width="+winwth+",height="+winht;
          reportWindow = window.open(report, 'reportWin',s)
          reportWindow.focus()
     &#125;
</script>
To popup the window:

Code: Select all

<a href="javascript:firstWindow('filename.php',385,380)">click here</a>
The call defines the size of the popup window.