Need a php timer to show a link at 0

i need to fine a php code that will tick down from lets say 20 seconds to 0 seconds then reveal a link or another php funtion
similar to this js timer here

function CreateTimer(TimerID, Time) { Timer = document.getElementById(TimerID); TotalSeconds = Time;
UpdateTimer()
window.setTimeout("Tick()", 1000);

}

function Tick() {
if (TotalSeconds <= 0) {
document.write(<?php
$customField = get_post_custom_values(“file_attachment”);
if (isset($customField[0])) {
echo ‘

Download Now!

’;
} ?>)
return;
}
TotalSeconds -= 1;
UpdateTimer()
window.setTimeout("Tick()", 1000);

}

function UpdateTimer() {
Timer.innerHTML = TotalSeconds;
}

PHP runs server side, so you can write a script that will wait for 20 seconds, but the client won’t see anything.
If you want the client to see a running timer you’ll need to use javascript.
What you CAN do is write the javascript so that when the timer reaches 0 it sends a request to the server where a PHP script will pick up the request and reply what you want to show.

Is that maybe what you want?

O.

yes that is fine i can run the js timer above where the php link will be released in the same time the js file hits 0.

Ill have 2 things going off.

the js timer will be counting down and links to nothing.

while

there is a time delay in a php function

I want this php code to display the link on the page after 20 seconds. <?php $customField = get_post_custom_values("file_attachment"); if (isset($customField[0])) { echo '

Download Now!

'; } ?>

I found another way of doing this to get the result i want thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service