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 wrote
Output from action.php: <script> opener.location.reload(); close(); </script>
Rich Fox wrote:
Warning for server side purists: My php scripts use javascript to popup
and
close 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 into
it is
mainListing.php. From mainListing.php I popup another window, with a
form
and 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 close
the
popup. Then I have to refresh the browser window manually to see the
updated
table from the database. Can I get some advice on how to accomplish (1)
and
(2) above?
Many thanks,
Rich
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php