Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Php 2 minute countdown timer


ghost's Avatar
0 0

Heyy Guys, I need a simple php countdown timer which after two minutes does event() or whatever i tell it to. And i want it to be live (shows how much time has gone etc.)… Nothing too fancie just uber basic … Any suggestions would be awsome!!!! Thanks Dotti.


ghost's Avatar
0 0

ah dont worry, i tried it and the site froze and so did my pc, i thankyou anyway! im sure ill find it usefull oneday :P


ghost's Avatar
0 0

couldnt you just use sleep() ?

should work for this…except like showing the time

and wont freeze anything i dont think

you could do the countdown in jscript though

http://us3.php.net/sleep

hope this helps:)

tits (o )( o)


ghost's Avatar
0 0

this is what AJAX is for….


ghost's Avatar
0 0

mr noob wrote: this is what AJAX is for….

or that lol

my way is the lazy way :p


ghost's Avatar
0 0

and sleaz… i tried not to laugh when you said "make js echo the countdown before the sleep". good luck to you, trying to execute js before php :P


ghost's Avatar
0 0

mr noob wrote: and sleaz… i tried not to laugh when you said "make js echo the countdown before the sleep". good luck to you, trying to execute js before php :P

lol…goddamnit….

gotta think before i type…

ill fix that right now:p


ghost's Avatar
0 0

<script> var s=120; func count() { if(s>0) { setTimeout('document.f.d.value=s;s–;count();',1000); } else { ajaxFunction(); } } count(); </script> <form name="f"> <input type="text" name="d"> </form>

tada! edit shit forgot the sleep :P


ghost's Avatar
0 0

well wait couldnt you just do

&lt;script src=&quot;time_countdown_thing.js&quot;&gt;&lt;/script&gt;

&lt;?
sleep(120);

echo &quot;stufff after it sleeps&quot;;

?&gt;

and the time would show….

so im right…

you just have it show the time and then do the stuff after it sleeps

i just said it wrong…lol…im problably still saying it wrong but you get what i mean

either that or im retarded:)

but your way is still the best lol…

i just dunno ajax


ghost's Avatar
0 0

um… you do know nothing is processed during sleep() so you couldnt echo the time… fixed my script above ^^


ghost's Avatar
0 0

lol ive never used sleep…

dunno if everything on the page doesnt get processed or not

idk…

just thought sleep could be used in this situation:angry:


ghost's Avatar
0 0

mr noob wrote: <script> var s=120; func count() { if(s>0) { setTimeout('document.f.d.value=s;s–;count();',1000); } else { ajaxFunction(); } } count(); </script> <form name="f"> <input type="text" name="d"> </form>

eh thanks … but i cant work it…?