Help - Search - Members - Calendar
Full Version: OT: PHP Question
914World.com > The 914 Forums > 914World Garage
ThinAir
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!
thomasotten
It seems like you might have to use javascript to open the new php file.
Rand
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.
ThinAir
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
Rand
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
Rand
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.
ThinAir
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!
ThinAir
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!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.