html - Button Click Counter in PHP -


I am trying to build a small skeleton frame for a friend, where each button is run an animation . She wants a way to calculate the number of clicks the button is being done, and I can not even find that part working. What am I doing wrong?

  & lt ;? Php if (isset ($ _ POST ['mushu'])) {resonant "working."; PlayAnimation (); ClickInc (); } Function Play animation () {/ * ... * /; } Function clickInc () {$ count = ("clickcount.txt"); $ Click = file ($ count); $ Clicks [0] ++; $ Fp = fopen ($ count, "w") or die ("can not open file"); Fputs ($ fp, "$ click [0]"); Fclose ($ FP); Per Click [0]; }? & Gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Adobe kitten & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form action = "& lt ;? Php $ _SERVER ['PHP_SELF'] ;; & gt; & Gt; & Lt; Input Type = "Button" value = "Let's see what the hell is." Name = "mushu" & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

  & lt; Form action = "& lt ;? Php $ _SERVER ['PHP_SELF'] ;? & Gt;" method = "post" & gt; & Lt; Input type = "submit" value = "let's see what the fuck is." Name = "mushu" & gt; & Lt; / Form & gt; First, 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 changed the type = "button", to type = "submit".

should work


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -