my error is that the value just stays 0 and ive checked to make sure seconds has a value and once i put it at the bottom and ran the code (just echoing it) it showed a value of 359999 which is what i want to be in my text box named counter
here is me code
<html>
<head>
<script>
function countdown(){
frmcountdown.counter.value=timer;
x=frmcountdown.counter.value;
x--;
frmcountdown.counter.value=x;
if (x>0){
setTimeout("countdown()",1000);
}
else{
alert("out of time");
}
}
</script>
</head>
<body>
<form name="frmcountdown">
<?php
include "mysql.php";
global $c;
$is=mysql_query("SELECT * FROM timer WHERE id='1'", $c) or die(mysql_error());
$ir=mysql_fetch_array($is);
$seconds=$ir['seconds'];
echo "<input type='text' name='counter' size='3' value='{$seconds}'>";
// above being where my error is happening
?>
<input type="button" value="start" onclick='setTimeout("countdown()",1000);'>
</form>
</body>
</html>
thanks fore reading me question
here is me code
<html>
<head>
<script>
function countdown(){
frmcountdown.counter.value=timer;
x=frmcountdown.counter.value;
x--;
frmcountdown.counter.value=x;
if (x>0){
setTimeout("countdown()",1000);
}
else{
alert("out of time");
}
}
</script>
</head>
<body>
<form name="frmcountdown">
<?php
include "mysql.php";
global $c;
$is=mysql_query("SELECT * FROM timer WHERE id='1'", $c) or die(mysql_error());
$ir=mysql_fetch_array($is);
$seconds=$ir['seconds'];
echo "<input type='text' name='counter' size='3' value='{$seconds}'>";
// above being where my error is happening
?>
<input type="button" value="start" onclick='setTimeout("countdown()",1000);'>
</form>
</body>
</html>
thanks fore reading me question