View Full Version : WTK : Popup 101 in PHP environment

10-28-2003, 01:26 PM
I am looking for a code snippet that could be run in a strict PHP environment to do a window popup. Specifically, I will have a page with a <a href....> where, if clicked, I would like to have a popup in a new window open. I will be passing a variable value along with the <a href link which will run a query to a MySQL table to pull the actual popup window content.

I'm ok on the PHP and MySQL stuff. I would like a little assistance on the protocol to initiate another window. I'm pretty much JavaScript illiterate.



10-28-2003, 01:34 PM
PHP is a server-side language as such cannot control and aspect of the features of the client-side browser. To open a new window requires either HTML or Javascript and not PHP. It sounds like you wish to use Javascript to open a new window.

I will move you to the javascript forum.

Note that many people use pop-up blocking software these days and any pop-pops that are essential to the function of your site may become disabled which will disable your site.

10-28-2003, 01:48 PM
I fully understand that PHP is client-side. The entire html is being rendered through php, thus my original request. As far as popup blocking again, I am fully aware of the limitations. The application that this would be used in is a corporate environment within an InfraNet. Popup blocking is not an issue here.


10-28-2003, 02:16 PM
Actually PHP is a server-side language. Your web browser will never see a line of PHP code. Once a PHP document is done being parsed by the PHP parser only client-side code such as HTML, Javascript, CSS etc will be outputted to the browser.

To open a popup window you will use javascripts open() function that is used with the window object.

window.open() Inside the parenthesis is a number of parameters that you can use to define the file to be opened and the size, location and features of the window being opened.