Home » Php » Show countdown from 10 to 0 seconds – PHP

Show countdown from 10 to 0 seconds – PHP

Posted by: admin February 22, 2020 Leave a comment

Q(Question):

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

Stephanie

A(Answer):

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

Stephanie

Cannot really be done with PHP, try JavaScript.

Simon

A(Answer):

> Cannot really be done with PHP, try JavaScript.
Bad luck, i try to avoid JavaScript. Some visitors disabled JavaScript.

Stephanie

A(Answer):

Cannot really be done with PHP, try JavaScript.

Bad luck, i try to avoid JavaScript. Some visitors disabled JavaScript.

Stephanie

Who is it bad luck for?
PHP is _server side_ a countdown is _client side_.

Simon

A(Answer):

Stephanie wrote:

Cannot really be done with PHP, try JavaScript.

Bad luck, i try to avoid JavaScript. Some visitors disabled JavaScript.

Stephanie

the number of people who know how to disable javascript is minute.

of the people who *do* know how to disable javascript, very few bother
to do so.

i imagine that those people who *both* know how to disable it and
*actually* disable it are probably going to manage to surf your site
without the help of a countdown ticker.
sadara

A(Answer):

My oppinion is that the best way is Flash !!!
Just for the CountDown…
I don’t think that someone will be afraid of flash !!!

A(Answer):

> PHP is _server side_ a countdown is _client side_.

Why can’t you countdown server sided ?

Stephanie

A(Answer):

Stephanie wrote:

PHP is _server side_ a countdown is _client side_.

Why can’t you countdown server sided ?

Your question is not clear. Do you want countdown to be shown in
browser (inputbox, div, etc)?? or You just want to countdown the
seconds (say 10 seconds of sleep)??


<?php echo ‘Just another PHP saint’; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

A(Answer):

On Wed, 27 Jul 2005 15:22:52 +0200, Stephanie wrote:

PHP is _server side_ a countdown is _client side_.

Why can’t you countdown server sided ?

You can, but the client won’t see it. What do you need the countdown for,
anyway? If it’s just for a more or less arbitrary delay, use an animated
gif and refresh the page using the ‘meta refresh’ header set at 10 sec.

I hate countdowns that don’t do anything.


Firefox Browser – Rediscover the web – http://getffox.com/
Thunderbird E-mail and Newsgroups – http://gettbird.com/

A(Answer):

On Wed, 27 Jul 2005 13:39:32 +0200, Sadara wrote:

of the people who *do* know how to disable javascript, very few bother to
do so.

Roughly 10% do, depending on where you get your numbers


JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

A(Answer):

On Wed, 27 Jul 2005 12:08:42 +0100, Simon wrote:

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

Stephanie

Cannot really be done with PHP, try JavaScript.

Simon

Or you can META Refresh at one second intervals, loading the next
incremented number page each time.

Or you could use an animated GIF

Or you could use Flash (as another poster suggested).

Or possibly a Java Applet.

I vote for JavaScript, though.


JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

A(Answer):

On Wed, 27 Jul 2005 13:00:55 +0200, Stephanie wrote:

I have a newbie question (couldn’t find the answer with google) How to
show countdown from 10 to 0 seconds.

Stephanie

Your question is too unspecific/ambiguous.

What are you trying to do, exactly?

Why do you want to do it?

Why do you think it would be PHP-related, this question?

More details, please…


JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

A(Answer):

I have an errorpage that redirects after 10 seconds. So i’d like to show how
many seconds before redirection.
Within that time a visitor can chose to send an email to the webmaster.
So it’s not entirely necessary, but it’s a service :-))
So i need some advice to show (not how to redirect within 10 seconds) the
remaining seconds within my text.(not a textbox or somthing)
(Sorry, this page was not found. In 10 seconds, you will be redirected to
our main page.)

Stephanie

A(Answer):

Stephanie wrote:

I have an errorpage that redirects after 10 seconds. So i’d like to show how
many seconds before redirection.
Within that time a visitor can chose to send an email to the webmaster.
So it’s not entirely necessary, but it’s a service :-))
So i need some advice to show (not how to redirect within 10 seconds) the
remaining seconds within my text.(not a textbox or somthing)
(Sorry, this page was not found. In 10 seconds, you will be redirected to
our main page.)

Then.. probably, you may have to try something like this
<http://in2.php.net/flush#52147> with META refresh.


<?php echo ‘Just another PHP saint’; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

A(Answer):

"Stephanie" <St*******@nospam.1234> wrote in message
news:bd***************************@news.versatel.n l…

I have an errorpage that redirects after 10 seconds. So i’d like to show
how many seconds before redirection.
Within that time a visitor can chose to send an email to the webmaster.
So it’s not entirely necessary, but it’s a service :-))
So i need some advice to show (not how to redirect within 10 seconds) the
remaining seconds within my text.(not a textbox or somthing)
(Sorry, this page was not found. In 10 seconds, you will be redirected to
our main page.)

Ah, yes, this is a javascript question. To make it usable for those with js
turned off, just provide a regular link under your timer thing. "if you are
not automagically redirected, or dont want to wait, click here" You should
do that anyway, so I dont have to wait.


juglesh

A(Answer):

<comp.lang.php , Stephanie , St*******@nospam.1234>
<c2**************************@news.versatel.nl>
<Wed, 27 Jul 2005 13:00:55 +0200>

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

– print 10 on the screen
– while loop timed for a one second delay
– print 9 on the screen
– repeat until 0

But using some sort of witty animated gif to amuse the user until the
refresh takes place would probably be much better .

A(Answer):

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

– print 10 on the screen
– while loop timed for a one second delay
– print 9 on the screen
– repeat until 0

But using some sort of witty animated gif to amuse the user until the
refresh takes place would probably be much better .

Have you even tried it yourself to see what happens?

Simon

A(Answer):

<comp.lang.php , Simon , sp********@example.com>
<3k************@individual.net>
<Wed, 27 Jul 2005 17:32:09 +0100>

– print 10 on the screen
– while loop timed for a one second delay
– print 9 on the screen
– repeat until 0

But using some sort of witty animated gif to amuse the user until the
refresh takes place would probably be much better .

Have you even tried it yourself to see what happens?

Of course not 🙂

A(Answer):

Stephanie wrote:

I have an errorpage that redirects after 10 seconds.
[…] it’s a service :-))

You misspelt ‘disservice’. Good luck with it though.


Jock

A(Answer):

<comp.lang.php , John Dunlop , us*********@john.dunlop.name>
<MP************************@news.ntlworld.com>
<Wed, 27 Jul 2005 17:21:35 GMT>

I have an errorpage that redirects after 10 seconds.

[…]

it’s a service :-))

You misspelt ‘disservice’. Good luck with it though.

What if you nip in and out of php when doing the loop .

Surely there must be some way to achieve the effect .

A(Answer):

SOR wrote:

What if you nip in and out of php when doing the loop .

I’d nip that loopy idea in the bud right now, SOR!
Surely there must be some way to achieve the effect .

Of course, for some, some of the time.


Jock

A(Answer):

On Wed, 27 Jul 2005 13:25:02 +0200, Stephanie wrote:

Cannot really be done with PHP, try JavaScript.

Bad luck, i try to avoid JavaScript. Some visitors disabled JavaScript.

Stephanie

But as PHP is a server side scripting language, how do you expect to
implement this client side functionality?

Steve

A(Answer):

I noticed that Message-ID:
<MP************************@no-cancel.newsreader.com> from SOR contained
the following:

You misspelt ‘disservice’. Good luck with it though.

What if you nip in and out of php when doing the loop .

Surely there must be some way to achieve the effect .

How many times have you waited more than a second for a busy server to
respond? A very small animated gif, maybe like a progress bar, would be
my favourite.

Geoff Berrow (put thecat out to email)
It’s only Usenet, no one dies.
My opinions, not the committee’s, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

A(Answer):

<comp.lang.php , Geoff Berrow , bl******@ckdog.co.uk>
<ap********************************@4ax.com>
<Wed, 27 Jul 2005 19:34:00 +0100>

What if you nip in and out of php when doing the loop .

Surely there must be some way to achieve the effect .

How many times have you waited more than a second for a busy server to
respond?

I’m on a dialup up not the best person to say .

A(Answer):

> Or you can META Refresh at one second intervals, loading the next

incremented number page each time.

Or you could use an animated GIF

Or you could use Flash (as another poster suggested).

Or possibly a Java Applet.

I vote for JavaScript, though.

Is this "comp.lang.php"? if not then all your sugestions are indeed valid.

Simon

A(Answer):

Stephanie wrote:

I have a newbie question (couldn’t find the answer with google)
How to show countdown from 10 to 0 seconds.

Stephanie

actually you could try with flush or meta refresh…but safest bet is with
gif..second would be javascript


Dominik Susmel | art director
www.vongestern.com | vonGestern art company . Zagreb, Croatia

A(Answer):

SOR <we*******@sparesorrepair.co.uk.INVALID> wrote:

<comp.lang.php , Simon , sp********@example.com>
<3k************@individual.net>
<Wed, 27 Jul 2005 17:32:09 +0100>

> – print 10 on the screen
> – while loop timed for a one second delay
> – print 9 on the screen
> – repeat until 0
>
> But using some sort of witty animated gif to amuse the user until the
> refresh takes place would probably be much better .

Have you even tried it yourself to see what happens?

Of course not 🙂

I’ll tell you what would happen. The user would see nothing at all for a
ten-second delay, followed by "10 9 8 7 6 5 4 3 2 1 0", displayed all at
once.

HTTP is not an "interactive" facility. The contents of a page are batched
up and transmitted in large chunks.

– Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.

A(Answer):

Simon wrote:

Or you can META Refresh at one second intervals, loading the next
incremented number page each time.

Or you could use an animated GIF

Or you could use Flash (as another poster suggested).

Or possibly a Java Applet.

I vote for JavaScript, though.

Is this "comp.lang.php"? if not then all your sugestions are indeed valid.

Simon

Simon,

They suggestions are still valid. The request was for a php solution. There
isn’t one – but people were nice enough to provide alternatives rather than just
saying "it can’t be done".


==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

A(Answer):

Thx, all of you.
Interesting discussion. I have to think about it.

Stephanie

A(Answer):

>>>Or you can META Refresh at one second intervals, loading the next

incremented number page each time.

Or you could use an animated GIF

Or you could use Flash (as another poster suggested).

Or possibly a Java Applet.

I vote for JavaScript, though.

Is this "comp.lang.php"? if not then all your sugestions are indeed
valid.

Simon

Simon,

They suggestions are still valid. The request was for a php solution.
There isn’t one – but people were nice enough to provide alternatives
rather than just saying "it can’t be done".

That is not the impression I got from the reply.
The reply was directed at me and not the OP, furthermore the list of other
options given (to me), was not really helpful to the OP.

Simon

A(Answer):

On Fri, 29 Jul 2005 07:09:21 +0100, Simon wrote:

The reply was directed at me and not the OP, furthermore the list of other
options given (to me), was not really helpful to the OP.

It wasn’t helpful?


JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

A(Answer):

>

The reply was directed at me and not the OP, furthermore the list of
other
options given (to me), was not really helpful to the OP.

It wasn’t helpful?

IMHO, the list given does not really answer the OP’s question.

Simon