Goose87 Posted June 1, 2008 Share Posted June 1, 2008 Hey guys, I'm pretty sure this uses javascript, but I thought I'd post it in here as I have no knowledge of javascript and hoping there is some other way to do it. I have a variable, this is set using the time() feature and is obviously a large number like 1203394304 I then add 5 minutes to it - time()+300; and then minus the value, this gives a value in seconds of like 230 or something. At the moment it displays: You have 1 minute 23 Seconds until... but this updates only when you refresh the page, I want the timer to auto count-down. Does anyone know how to do that?? Cheers. Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/ Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 You are right. You need Javascript to do this. Or you can use some html code to auto-refresh it to get an update, but that's not really the same...php is a server side language. Everything is parsed on the server and then sent to the client. Once it's done, that's the end of that, as far as php is concerned. Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/#findComment-555040 Share on other sites More sharing options...
wildteen88 Posted June 1, 2008 Share Posted June 1, 2008 You'll need to use javascript yes. Not unless you keep refreshing the page every secound using a meta refresh. Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/#findComment-555042 Share on other sites More sharing options...
Goose87 Posted June 1, 2008 Author Share Posted June 1, 2008 Hmmm...refreshing the page will not work on my site. Does anyone here have any knowledge of javascript to help me with this? I have posted it too in the javascript forum, but this one has a lot more people on it Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/#findComment-555050 Share on other sites More sharing options...
wildteen88 Posted June 1, 2008 Share Posted June 1, 2008 Easiest solution would be to search google for a javascript countdown timer script. Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/#findComment-555055 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 Do you really want to look for javascript help in a php forum, on a primarily php site? Normally I would move your thread to the javascript forum, but since you said you already posted there...nothing personal, but thread closed. Link to comment https://forums.phpfreaks.com/topic/108269-countdown-timer/#findComment-555056 Share on other sites More sharing options...
Recommended Posts