Reputation: 117
I know php is server-side, but is there a way to make this window close after 3 seconds?
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
$contact_message=$_POST['message'];
$errpage = $_POST['frompage'];
$ip=$_SERVER['REMOTE_ADDR'];
$message = "$contact_message -SENT FROM THIS IP: $ip";
mail("[email protected]", "$Error Reported on: $errpage", $message);
echo "We have documented the web address of the problem and thank you for helping us improve our site!"
?>
Upvotes: 2
Views: 36437
Reputation: 101
It is very simple - just write the JavaScript code in PHP with echo in the place where you want to move out from itself, such as:
<?php
echo '<script> window.setTimeout("window.close()", 1000); </script>';
?>
It will definitely work.
Upvotes: 1
Reputation: 362
It may seems a little weird if a page I am watching suddenly be closed.
Upvotes: -1
Reputation: 1647
This should do it:
<script type="text/javascript">setTimeout("window.close();", 3000);</script>
Upvotes: 9