Düğme PHP Sayaç tıklayın

0 Cevap php

Ben bir düğme belirli bir animasyon her basıldığında oynanan bir arkadaşı için küçük bir iskelet çerçeve oluşturmak için çalışıyorum. O sayısını düğme de, tıklandığında saymak için bir yol istiyor, ama ben o bölümü çalışma almak gibi olamaz. Ben yanlış ne yapıyorum?

<?php

  if( isset($_POST['mushu']) )
  {
    echo "Working.";
    playAnimation();
    clickInc();
  }

  function playAnimation()
  {
     /* ... */;
  }

  function clickInc()
  {
    $count = ("clickcount.txt");

    $clicks = file($count);
    $clicks[0]++;

    $fp = fopen($count, "w") or die("Can't open file");
    fputs($fp, "$clicks[0]");
    fclose($fp);

    echo $clicks[0];

  }
?>

<html>

  <head>

    <title>Adobe Kitten</title>

  </head>

  <body>

    <form action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="button"
           value="Let's see what Mushu is up to."
           name="mushu">
    </form>

  </body>
</html>

0 Cevap