self closing

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I didn't find the answer in the FAQ at

I have a button on parent.php that launches a page (child.php) in a new  
window.  Child.php does some database activity and is silent (unless  
there is an error).  I want this child.php to close itself if there are  
no errors.  How can I do this?


Re: self closing

Quoted text here. Click to load it

PHP cannot close windows.  
However, you can use PHP to conditionally write javascript to do it.

Karl Groves

Accessibility Discussion List:

Re: self closing

Karl Groves wrote:
Quoted text here. Click to load it

Said Javascript would look like

<script language="Javascript">


echo "<script language=\"Javascript\">";
echo " window.close();";
echo "</script>";

or do this and wait until the user gets bored and closes the browser
themselves, or IE crashes.

while (true)
   echo "x";

Re: self closing

I think, it could be better if you just go to the child.php, do your
database activity and, if done, return with a header(Location : '') to
the parent.php

While your page has no output data, you don't really have to open it in
a new window.

Site Timeline