Hi everyone.

Is there a guru who can tell me how to do this;

What I need,
When on page x, one can click a link where page z opens as a popup. Page z has to collect data, and when finished, page z has to send the daa back to page x. If possible, page z has to close automatically when posting the data back to page x. It is obvious that page x has to reload once the data has been posted back by page z.

This is mainly it. I will appreciate if someone could assist, and also, if someone can tell me how to specify the popup page's dimensions - I don't want to use javascript.

Recommended Answers

All 5 Replies

Member Avatar for langsor

What you are asking can not be done with PHP ... PHP is a server side language, once the page is written to the browser, PHP can no longer change the page environment.

You can otherwise have your pop-up window post to a PHP script on the server, and have the parent (original) window auto-refresh every so often using meta refresh tag -- but that will be annoying to your visitors, I'm sure.

You could do the above and not have the page auto-refresh but prompt the visitor to refresh the page to see results after submitting results on the pop-up window

Also you cannot auto-close the window with PHP

Everything you are asking requires JavaScript -- sorry, but at least it's easy stuff to do in JavaScrpt :-)

And, since you're using javascript anyway, you might as well update the parent page without reloading it ... using javascript.

Good luck

If you're just worried about javascript being disabled in the visitors' browser, you can place the form on the parent page (like a normal form) and then use javascrpt to make the form go away if javascript is there (easy test, it works or it doesn't), and replace the form with the link to the javascript popup, auto-parent-refreshing, auto-pop-up-closing functionality.

:-)

What you are asking can not be done with PHP ... PHP is a server side language, once the page is written to the browser, PHP can no longer change the page environment.

You can otherwise have your pop-up window post to a PHP script on the server, and have the parent (original) window auto-refresh every so often using meta refresh tag -- but that will be annoying to your visitors, I'm sure.

You could do the above and not have the page auto-refresh but prompt the visitor to refresh the page to see results after submitting results on the pop-up window

Also you cannot auto-close the window with PHP

Everything you are asking requires JavaScript -- sorry, but at least it's easy stuff to do in JavaScrpt :-)

And, since you're using javascript anyway, you might as well update the parent page without reloading it ... using javascript.

Good luck

If you're just worried about javascript being disabled in the visitors' browser, you can place the form on the parent page (like a normal form) and then use javascrpt to make the form go away if javascript is there (easy test, it works or it doesn't), and replace the form with the link to the javascript popup, auto-parent-refreshing, auto-pop-up-closing functionality.

:-)

Thanx for the extended reply.

Ok, well, is it then possible to ;

- When on page x, post data to page z, which is a popup (know how to do this)
- Continue with page z
- When completed page z, post the data bo the parent page, but have the parent page opening a new page.

Let me know and thank you again.

Member Avatar for langsor

Playing around a little in Firefox 3 and Explorer 7 it appears that you can post a form with a target attribute ... what this translates to is that you can have a parent window action be the child window, and have the child window form target the parent window ...

There is a limitation though. The child window will not post back to its parent, but open a new parent window ... from there the two dynamically opened windows will talk back and forth with posted form values, excluding the original opener window.

Play with this some

parent.php

<html>
<body>
<?php
print_r( $_POST );
?>
<form action="child.php" target="blank" method="POST">
  <input type="text" name="foo" />
  <input type="submit" />
</form>
</body>
</html>

child.php

<html>
<body>
<?php
print_r( $_POST );
?>
<form action="parent.php" target="parent" method="POST">
  <input type="text" name="bar" />
  <input type="submit" />
</form>
</body>
</html>

thanx so much.!!!

Great Stuff! It works much better in IE because the new[Ctrl + N] comes on top of the main/parent window. So the user/visitor won't make a mistake of filling the form many times untlike in Firefox because you might not notice the new tab[Ctrl + T]...Thanks a lot!

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.