Re: Reloading a specific window
| From: | Marek Kilimajer | Date: | Fri, 03 Oct 2003 14:55:31 +0000 |
| Subject: | Re: Reloading a specific window | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164910@lists.php.net to get a copy of this message | ||
1. you have the main window.
2. user clicks ADD, new windows pops up
3. user enters data into the new window, submits
4. action.php updates database and outputs:
<script language="javascript">
document.window.opener.reload()
self.close();
</script>
<noscript>Close this window and reoad the main window</noscript>together with all necessery html stuff Rich Fox wrote:
This does not work, when I replace my header function with: elseif (isset($_POST['btnSave'])) {.. database update, then... $ostr = <<< OUTPUT; <script language="javascript"> document.window.opener.reload() self.parent.close(); </script>OUTPUT;echo $ostr; //header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']); exit;} several things happen: the database update does not happen, the mainwindow does not reload, and my form disappears from the popup frame and this frame is blank. I am probably doing something very stupid. Marek Kilimajer wroteOutput from action.php: <script> opener.location.reload(); close(); </script> Rich Fox wrote:andWarning for server side purists: My php scripts use javascript to popupit isclose windows. So this question, although posted to a php newsgroup, has elements of javascript too. Gasp! No flames please. I have a main window which I will refer to as mainwindow (window.name='mainwindow' in the onload event). The script loaded intoformmainListing.php. From mainListing.php I popup another window, with atheand a save button. The form's action is "action.php" In action.php I update the database and then would like to: (1) refresh mainwindow so it reflects the database changes, and (2) close the popup window. I have been reading, tweaking, trying different things but nothing is working. Currently, the action script does: ... elseif (isset($_POST['btnSave'])) { .. update the database, then ... header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']); exit; } ... This reloads the popup window, and then I have a "close" button to closeupdatedpopup. Then I have to refresh the browser window manually to see theandtable from the database. Can I get some advice on how to accomplish (1)(2) above? Many thanks, Rich