View Full Version : pop up window and parent window

12-08-2006, 02:46 PM
If I have a pop up window that has a form and I have to upload an image, I am going to have to send that form to a php page to upload the photo. Once the page has been submitted, can I still send variables back to the parent page?

The popup will be windowA.php and will submit to pageB.php and pageB.php needs to send variables to parent.php.

Is this doable?

12-08-2006, 02:56 PM
I believe that a child window can alter the contents of a parent window, but I don't know how this is done (I am something of a javascript noob myself!).

As regards the PHP side of things, remeber that PHP is server-side and Javascript is client-side - therefore javascript on a web page can only alter the HTML for that web page and not the PHP that was used to generate it. By all means, you can have the child window call back to a PHP page on the server which then alters the behaviour of PHP which generates the parent window for all subsequent client requests for that page.

I may be telling you something which is obvious to you already, but your post seemed a little unclear.


12-08-2006, 03:11 PM
I am going to have users click a link on parent.php and there will be a form on page popup.php. Normally onClick I would have javascript send info back to the parent page, but since I am uploading a photo, I have to use php (Unless you can do it with javascript). So the form from popup.php will be submitted to pageb.php.

Once the page has been submitted, can pageb.php call a function on parent.php?

12-08-2006, 03:20 PM
Yes, you can do that it would seem; I;ve just done a google search as follows: http://www.google.co.uk/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial_s&hl=en&q=child+window+modifying+parent+in+javascript&meta=&btnG=Google+Search

12-08-2006, 03:29 PM
mlse, I know how to pass from the child that was originally popped up to the parent. Once I submit the form and a NEW page (pageB) opens in the child window, this is when I need to send a function back to the parent window.

Do I need some sort of button to do it or can it do it by itself?

12-08-2006, 04:05 PM
Ok I see what you mean now.
I dunno :rolleyes:

I can think of a number of flaky hacks to get round it if it isn't possible! (e.g. calling a time-delayed function in the parent page before the form is submitted).