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:
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<input type="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:
<input type="submit" value="Let's see what Mushu is up to." name="mushu" />
Post a Comment for "Button Click Counter In PHP"