Hi I have a problem. I have a button on my website, I want it to counts how many times it has been clicked and display it under it. fx <button here> This button has been clicked 2746 times. I allready have a coded button with a function, which it must keep. Mads Pedersen
Well, if you want it only php you should redirect it to another page, which inserts data into the database. And the other should be easy
the code is onclick="javascript:countclick();" and the code for countclick() is: function countclick() { var c=new Image(); img.src="/counter.php"; }
Hi, I too feel that its the simplest way. In case you need more help then visit w3schools.com. Take care.
If your sticking it in a database or a txt file then you'll need some php. Then have a div under the button and update that with innerHTML through JavaScript (if your using ajax - if your posting it back then get PHP to update the number).