Closing a page with PHP

Discussion in 'PHP' started by jzieba01, Nov 18, 2009.

  1. #1
    I have a simple php scrip which launches the user's email client with a specified address.

    At the end of the script, I want to close the page running the script.

    Is this possible?

    
    <?php
    $loc='<META HTTP-EQUIV="Refresh" Content="0; URL=mailto:'.$part1.'@'.$part2.'">';
    echo $loc;
    ?>
    
    Code (markup):
     
    jzieba01, Nov 18, 2009 IP
  2. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #2
    No because it will already have redirected them. Why would you need the page to close? If you must you can't use JavaScript.
     
    Pudge1, Nov 18, 2009 IP
  3. jzieba01

    jzieba01 Guest

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want the window to close so there is not a blank browser window left open. The php page is launched from an html page. The php page opens the email client.
     
    jzieba01, Nov 18, 2009 IP
  4. SIAWebDesign

    SIAWebDesign Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you need to use javascript. open the page and close it using javascript.
     
    SIAWebDesign, Nov 18, 2009 IP
  5. insert

    insert Peon

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yeah, you'll ned something like:
    echo "<script>window.close();</script>";
     
    insert, Nov 18, 2009 IP
  6. cignusweb

    cignusweb Peon

    Messages:
    147
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you must be use java script window.close();
     
    cignusweb, Nov 19, 2009 IP
  7. taminder

    taminder Peon

    Messages:
    581
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    you can do it if you have a mail form on your php page (which is probably a better solution to do what you are trying to do) if you want to have control over when the page closes. you can't close it, but you can redirect it after a time limit.
     
    taminder, Nov 19, 2009 IP