Is it possible to get a PHP page to popup in a new page after a form post? Then, return information from the popup page to the parent page? Right now when I post my data, the browser window navigates to the new page and I have no way to get the data from my PHP popup page back to the parent page.

Thanks in advance,

M

Recommended Answers

All 3 Replies

Member Avatar for diafol

I don't think that php can communicate between web browser windows. You could use javascript to create parent-child relationships and use a mix of php/js to display a popup.

You may be better off using a lightbox type popup that displays the sent data, that way you don't annoy your users by opening a new window.

Remember that ALL your form data should be passed to the $_POST variable so that you have all the data to hand to display in a lightbox if required - no need for any messy $_SESSION or $_GET variables.

Your pop-up window should have the same session as the main browser window. Since php is a server script, it can handle session data. That would be the link in between those windows. Write to session data from the pop-up and retrieve it with the main window. If the session should differ, you can always put the data on a file on the server and retrieve it from there, or you can use a database if it is accessible for you.

Member Avatar for diafol

Do you really need to duplicate $_POST data into $_SESSION vars? Not disagreeing, have done this myself in the past. With a lightbox type arrangement, no duplication required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.