On Mon, Feb 06, 2006 at 02:05:55PM -0500, tedd wrote:
> Hi:
> 
> This might seem like a odd question, but in php I can leave a script 
> by "exit;" But, how can I also close the html page that contains the 
> script?
> 
> I know that I can close the page many different ways via a user 
> actions, but how can I close it from within a conditional php 
> statement?
> 
> Thanks.
> 
> tedd
> -- 
> --------------------------------------------------------------------------------
> http://sperling.com/
> 

I've usually resorted to using Javascript:

function close_window($msg='')
{
    echo "<script language='Javascript'>\n";
    if (!empty($msg)) {
        echo "alert(\"$msg\");\n";
    }
    echo "self.close();\n";
    echo "</script>\n";
    exit;
}

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
CCNA, CISSP# 65668

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to