-2

I am trying get a counter to work in PHP so it basically counts '5' then '4' and so on till 0. It will redirect to a different page. I was just wondering how this can be done in PHP? if possible, if not what it would be in javascript?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
  • 1
    Java **is not** JavaScript. Also, this can be done with plain JavaScript, it is not hard to search for. – Luiggi Mendoza Nov 08 '13 at 15:28
  • 1
    You should try do some research, test a few things and post code that you are having problems with. –  Nov 08 '13 at 15:28
  • Counting down in PHP is an entirely different proposition from counting down in javascript. See also: `setTimeout` for javascript, `sleep` and `for/while` for PHP, and Google for basic and general questions. – Chris Baker Nov 08 '13 at 15:39

2 Answers2

0

Take a look at this. Other than that … you should really try to do some original research yourself and ask meaningful questions if you are stuck by illustrating your problem and showing us your current solution/approach.

Nikolas Grottendieck
  • 2,548
  • 1
  • 24
  • 24
0

The following code will redirect after 5 seconds:

<script>
setTimeout(function () {
       window.location.href = "newpage.html"; 
    }, 5000); //seconds
</script>

here's a example of count down timer: link

Rayhan Muktader
  • 2,038
  • 2
  • 15
  • 32