Printable Version of Topic

Click here to view this topic in its original format

914World.com _ 914World Garage _ OT: PHP Question

Posted by: ThinAir914 Apr 6 2005, 01:54 PM

I want to create a dynamic web page that opens in a new window of a particular size. I understand about using the form action with a php page as the action so that it processes what I pass to it, but I'm wondering how to get the result to open in it's own window.

Seems like I remember some behaviour similar to this here at the club with the pop-up that tells you when you have a new PM, so I'm wondering if any of you guru's can tell me how to approach this. I'll be eternally grateful!

Posted by: thomasotten Apr 6 2005, 02:42 PM

It seems like you might have to use javascript to open the new php file.

Posted by: Rand Apr 6 2005, 03:02 PM

The Javascript method is like this:

window.open('pagename.php','title','width=640,height=480');

Give us more info if there's a reason you can't use Javascript.

Posted by: ThinAir914 Apr 6 2005, 03:53 PM

I need to pass the page information from the calling page. I've got several forms on the calling page, each with a button so that I can pass which button was selected. I'm not aware of a way to pass a value to the php page using the window.open() function.

I'm modify this page so that there is a button by each item for folks to bid on that item. The php page creates a form that they fill out with their bid and then mails it to me.
http://www.musnaz.org/auction2005

Posted by: Rand Apr 6 2005, 04:35 PM

In my example, pagename.php is the url. Just expand on that with querystring variables to pass info. You can read the querystring from your dynamic page the same way you would read info coming from a form...
pagename.php?a=whatever

Posted by: Rand Apr 6 2005, 04:39 PM

If you don't need to control the size of the popup window, you can bypass javascript and just make a url with the querystring variables and put a target='_blank' in the A tag.

Posted by: ThinAir914 Apr 6 2005, 05:14 PM

I think I've got it figured out. If I use this Javascript:
window.open('pagename.php?id=2','title','width=640,height=480');

Then I can have the pagename.php grab the value from the url by evaluating $_GET[id] and generating the response page based upon the submitted value.

I've never worked with Get as a form method so it had not occured to me that I could simulate this. This solution is actually easier because I don't need forms in my calling page - I can just use links that call the Javascript.

Thanks, Randy for the inspiration!

Posted by: ThinAir914 Apr 11 2005, 10:07 AM

Thanks to the assistance from you guys, my project went live this morning. You can check it out at http://www.musnaz.org/auction2005/

The auction that I put together is open to anyone so if you see something you like, feel free to bid! You'll be benefiting a club member by helping to underwrite my employment!

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)