I encountered a problem that I can’t solve. My point is to “click” my sybmit button and every time increase a counter, while this counter reach 10. For the first time it works, but this is it!
My test code is below :
<form name="testForm" method="post">
<?php $cnt=0; ?>
<input type="submit" name="next" id="next" value="NEXT"/>
<?php
if(isset($_POST['next'])){
if($cnt< 10){
echo $cnt.' --> ';
$cnt++;
echo $cnt;
}
}
?>
</form>
Only 0 –> 1 is printed, every time… please help!!
Thanks
Your counter isn’t saved between page loads. What you need to do is save the counter to a
$_SESSIONvariable