+ Reply to Thread
Results 1 to 3 of 3

Thread: close window

  1. #1
    Barn Enthusiast sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    432
    Rep Power
    7

    close window

    I was curious as to if there was a command that I could run from php that would close the window after the script runs.... I have this running from a form
    Code:
    <html>
    <head><title>HWHC Mail Sender</title></head>
    <body>
    <?php
    
    /* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
    $email = "myemail@email.com";
    $subject = "FMLA/LOA/STD REQUEST";
    $message = "1 - Name - ".$HTTP_POST_VARS['name']."\n2 - What kind of leave - ".$HTTP_POST_VARS['leave']."\n3 - When does leave begin - ".$HTTP_POST_VARS['begin']."\n4 - When does leave end - ".$HTTP_POST_VARS['end']."\n5 - If intermittent when continuous - ".$HTTP_POST_VARS['intrmtnt']."\n6 - Location to pickup at - ".$HTTP_POST_VARS['location']."\n7 - What number to fax to - ".$HTTP_POST_VARS['fax']."\n8 - Whose attention - ".$HTTP_POST_VARS['attn']."\n9 - What address to mail to - ".$HTTP_POST_VARS['addr1']."- ".$HTTP_POST_VARS['addr2']."\n10 - What is the preferred delivery method - ".$HTTP_POST_VARS['send']."\n11 - Callback number - ".$HTTP_POST_VARS['phone']."\n12 - E-mail address - ".$HTTP_POST_VARS['email'];
    /* Sends the mail and outputs the "Thank you" string*/
    if (mail($email,$subject,$message)) {
      echo "<h4>Thank you for sending email</h4>";
      print( '<a href="http://www.mywebsite.com">Home</a>' );
    } else {
      echo "<h4>Can't send email to $email</h4>";
    }
    ?>
    </body>
    </html>
    
    If I can't close this window, how do I make it automatically redirect to another website. I tried before but it said headers already sent. Obviously, I'm not well versed in php..... I am learning on the fly......
    Join our Folding team: DeveloperBarn Folding
    -----------------------------------
    Folding Stats - Stanford University
    Folding Stats - Extreme Over-Clocking
    Folding Stats - Kakao Stats
    Folding Stats - Xtreme CPU

    -----------------------------------

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I'm assuming you tried something like:
    Code:
    header("Location: http:// www. yoursite. com");
    
    This won't work because the header method must always be called before any output is sent and with no whitespace above the call.

    You can do this, which relies on JavaScript:
    Code:
    echo "<script>window.location=\"yourpage.php\"</script> ";
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Enthusiast sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    432
    Rep Power
    7

    Thanks! That did the trick
    Join our Folding team: DeveloperBarn Folding
    -----------------------------------
    Folding Stats - Stanford University
    Folding Stats - Extreme Over-Clocking
    Folding Stats - Kakao Stats
    Folding Stats - Xtreme CPU

    -----------------------------------

+ Reply to Thread

Similar Threads

  1. On submit then close form/window
    By Centurion in forum JavaScript Programming
    Replies: 25
    Last Post: March 2nd, 2009, 05:50 AM
  2. Open new window PROGRAMMATICALLY
    By Shem in forum .NET Development
    Replies: 4
    Last Post: November 10th, 2008, 11:12 AM
  3. Window.Open with ASP Querystring Parameter
    By todd2006 in forum JavaScript Programming
    Replies: 3
    Last Post: October 10th, 2008, 11:58 AM
  4. ModalPopup, Server Event, Repeater, Close ModalPopup
    By Shem in forum .NET Development
    Replies: 26
    Last Post: August 15th, 2008, 08:36 AM
  5. Alert and close advice
    By Rebelle in forum JavaScript Programming
    Replies: 9
    Last Post: June 20th, 2008, 12:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO