prova questo

codice:
<html>
<head>
<script>
var seconds = 1600;
var intv;

var secondsCopy = seconds;

function $(id) {
    return document.getElementById(id);
}


function writecounter(hh, mm, ss) {
    $('ore').innerHTML = (hh < 10)? "0"+hh : hh; 
    $('min').innerHTML = (mm < 10)? "0"+mm : mm;
    $('sec').innerHTML = (ss < 10)? "0"+ss : ss;
}


function startcount() {
    $('startlink').style.display = 'none'; 
    $('resetlink').style.display = 'inline'; 
    reloadTime();
}

function resetcount() {
    clearInterval(intv);
    $('startlink').style.display = 'inline'; 
    $('resetlink').style.display = 'none'; 
    secondsCopy = seconds;

    hh = Math.floor(secondsCopy / 3600);
    mm = Math.floor((secondsCopy - (hh*3600)) / 60);
    ss = secondsCopy - (hh*3600) - (mm*60);
    writecounter(hh, mm, ss);

}



function reloadTime() {
    hh = Math.floor(secondsCopy / 3600);
    mm = Math.floor((secondsCopy - (hh*3600)) / 60);
    ss = secondsCopy - (hh*3600) - (mm*60);
    writecounter(hh, mm, ss);
    secondsCopy--;
    if (secondsCopy != -1)  {   
        intv = setTimeout('reloadTime()', 900)
    }
    else {
      // fai qualcosa 
      clearInterval(intv);
      alert("ho finito!");
    }
    
}


var hh = Math.floor(seconds / 3600);
var mm = Math.floor((seconds - (hh*3600)) / 60);
var ss = seconds - (hh*3600) - (mm*60);
</script>
</head>
<body style="font: 10pt Verdana">

<form>
  <span id="ore" ></span> :
  <span id="min" ></span> :
  <span id="sec" ></span> 

  

  
  start
  Reset
</form>


<script>
writecounter(hh, mm, ss);
</script>

</body>
</html>

non puoi fare un query con php in quel punto. Al massimo puoi fare una chiamata al server con ajax e gestire il vlore di ritorno con una funzione di callback