# \[php\] countdown timer

**URL:** <https://forum.kirupa.com/t/php-countdown-timer/193398>\
**Category:** programming\
**Created:** [July 13, 2006, 2:43am UTC](https://forum.kirupa.com/t/php-countdown-timer/193398 "2006-07-13T02:43:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cokelatdesign](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@cokelatdesign](https://forum.kirupa.com/u/cokelatdesign)\
**Post date:** [July 13, 2006, 2:43am UTC](https://forum.kirupa.com/t/php-countdown-timer/193398/1 "2006-07-13T02:43:32Z")

</div>

Hi guys, how do I created count down timer using php?

The scenario is I want to make a contact form that will send to my email address, after the guests fill out the form I want redirect them to the thanks you page but then I want them to “re-direct” to the home page automatically

The script is

\<?php  
if(isset($\_POST[‘submit’])) {  
$to = "myemail@whatever.com";  
$subject = “Form”;  
$name\_field = $\_POST[‘name’];  
$email\_field = $\_POST[‘email’];  
$url = $\_POST[‘url’];  
$comments = $\_POST[‘comments’];

$body = “From: $name\_field  
E-Mail: $email\_field  
URL: $url  
Comments:  
$comments”;

echo “Thanks for filling out our testimonials”;  
mail($to, $subject, $body);  
} else {  
echo “blarg!”;  
}  
?\>

I also found script using microtime() in [php.net](http://php.net) but I don’t really understand how it’s work because everytime I refresh it, the time sometimes counting down sometimes counting up  
The script is

\<?php  
/\*\*

- Simple function to replicate PHP 5 behaviour  
\*/  
function microtime\_float()  
{  
list($usec, $sec) = explode(" ", microtime());  
return ((float)$usec + (float)$sec);  
}

$time\_start = microtime\_float();

// Sleep for a while  
usleep(1);

$time\_end = microtime\_float();  
$time = $time\_end - $time\_start;

echo "Did nothing in $time seconds  
";  
?\>
