Skip to content Skip to sidebar Skip to footer

Button Click Counter In Php

I'm trying to build a tiny skeleton framework for a friend, where each time a button is pressed a certain animation is played. He wants a way to count the number of times the butto

Solution 1:

<formaction="<?php$_SERVER['PHP_SELF']; ?>"method="post"><inputtype="submit"value="Let's see what Mushu is up to."name="mushu"></form>

First of all use the form with method="post", or change $_POST[] to $_GET[] in your Script.

And If your Button is not a Submit button, then you are not submitting the form. So I've changed type="button" to type="submit".

Should work

Solution 2:

The code looks fine, I tested it and it worked for me. I suggest:

  • Make sure the file isn't read-only.
  • Make sure the file is called "clickcount.txt"
  • Make sure it's in the same folder as your script.

Solution 3:

It would be helpful to know the error but a shot in the dark - it could be a problem with Write permissions?

also, change to:

<inputtype="submit" value="Let's see what Mushu is up to." name="mushu" />

Post a Comment for "Button Click Counter In Php"