click multiple times a submit button

Posted by Olga Anastasiadou on Stack Overflow See other posts from Stack Overflow or by Olga Anastasiadou
Published on 2011-01-16T17:36:00Z Indexed on 2011/01/16 17:53 UTC
Read the original article Hit count: 231

Filed under:

Hi all, 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

© Stack Overflow or respective owner

Related posts about php