views:

882

answers:

2

Hello,

I'm a PHP programmer...done some study on google and tried it, but didn't get the output i need

Users will enter the time in the textbox provided...now i need to give them counter from the time they entered ?

Example : If i enter 1:27:38 and click on submit

then time should get decreased and i shud get alert when it reaches to 0

Plz can anyone give me any guidance, how to implement this ?

Thanx

+1  A: 

In PHP:

list($hours, $minutes, $seconds) = explode(':', $_POST['time']);

$seconds = $hours * 3600 + $minutes * 60 + $seconds;

for ($i = $seconds; $i > 0; $i--)
{
   echo $i;
   sleep(1);
   flush();
}

echo 'Countdown finished.';
Alix Axel
+1  A: 
Robert L
Excellent, this is what i needThanx Robert, this saved some time for me
luvboy