Page 1 of 1

open popup>close>refresh main

Posted: Thu Jul 27, 2006 9:25 am
by cryogenic
there are 2 pages :
main.php
popup.php

--------------------------------

main.php :
has a link that open a new window (popup.php)

popup.php :
has a form. once the button is clicked, it will update the database, then this new window will close automatically.

when the new window closed, main.php will refresh automatically.

how to make these things possible? FYI, im using macromedia dreamweaver. sorry if my english is bad.

Posted: Thu Jul 27, 2006 9:26 am
by JayBird
Put this is you <head> tag

Code: Select all

<script language="JavaScript">
<!--
function refreshParent() {
  window.opener.location.href = window.opener.location.href;

  if (window.opener.progressWindow)		
  {
    window.opener.progressWindow.close()
  }
  window.close();
}
//-->
</script>
Then, after you have done your DB update, just call

Code: Select all

<script language="JavaScript">refreshParent();</script>
And please try to post in the correct forum!
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.

Posted: Fri Jul 28, 2006 2:09 am
by cryogenic
where should i put those codes. main.php or popup.php. i know nothing bout javascript.

* its in the rite place now. thanks mod. sorry anyway.. :D

Posted: Fri Jul 28, 2006 3:10 am
by JayBird
put it in popup.php

Posted: Fri Jul 28, 2006 1:41 pm
by cryogenic
solved!!!!

when db update done, just call the refreshParent

Code: Select all

if ($updateSQL) {
  echo "<body onload='refreshParent()'>"; }
thanks!!!!!!