Automatically close the Window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atiq
    New Member
    • Apr 2007
    • 36

    #1

    Automatically close the Window

    once the feedback is submitted the thank.html popups. however, i want this popup to only be displayed for 3 seconds and then for this window to automaticaly close it self. below is the code for thank.html

    [HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>
    <head>
    <script language="javas cript">
    settimeout("win dow.close()",50 0)
    </script> </head>
    <body>
    Thanks for your Feedback
    </body>

    </html>[/HTML]

    here is the code for the feedback.php file:

    [PHP]// ------------- CONFIGURABLE SECTION ------------------------

    // $mailto - set to the email address you want the form
    // sent to, eg
    //$mailto = "youremailaddre ss@example.com" ;

    $mailto = 'atiqisthebest@ hotmail.com' ;

    // $subject - set to the Subject line of the email, eg
    //$subject = "Feedback Form" ;

    //$subject = "Feedback by $name" ; ***MOVED to line 78***

    // the pages to be displayed, eg
    //$formurl = "http://www.example.com/feedback.html" ;
    //$errorurl = "http://www.example.com/error.html" ;
    //$thankyouurl = "http://www.example.com/thankyou.html" ;

    $formurl = "http://miraj.atiq.eu/index.html" ;
    $errorurl = "http://atiq.eu/error.html" ;
    $thankyouurl = "http://miraj.atiq.eu/" ;

    $uself = 0;

    // -------------------- END OF CONFIGURABLE SECTION ---------------

    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $name = $_POST['name'] ;
    $email = $_POST['email'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFER ER" );

    $subject = "Feedback by $name" ;

    if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit ;
    }
    if (empty($name) || empty($email) || empty($comments )) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    }

    if (get_magic_quot es_gpc()) {
    $comments = stripslashes( $comments );
    }

    $messageproper =

    "This message was sent from:\n" .
    "$http_referrer \n" .
    "------------------------------------------------------------\n" .
    "Name of sender: $name\n" .
    "Email of sender: $email\n" .
    "------------------------ COMMENTS ------------------------\n\n" .
    $comments .
    "\n\n------------------------------------------------------------\n" ;

    if(mail($mailto , $subject, $messageproper,
    "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep .
    "X-Mailer: feedback.php 2.08" ))

    {
    ?>
    <script language="javas cript">
    window.open ("thank.html"," mywindow","loca tion=1,status=0 ,scrollbars=0,w idth=400,height = 400");
    </script>
    <?

    $thankyouurl = 'http://www.miraj.atiq. eu';
    echo '<meta http-equiv="refresh" content="5;url= '.$thankyouurl. '">';
    }

    ?>[/PHP]

    Any help would be greatly appreciated!

    Thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    settimeout should be setTimeout (JavaScript is case-sensitive).

    3 seconds = 3000 milliseconds.

    Comment

    Working...