click counter when link is pressed
Hi,
I would like to incorporate a counter that counts up every time a link is clicked.
I don't want to use a database...just one link that says "click here" and a counter displayed right next to the link that starts at 0 and counts up every time the link is clicked. I would also like the browser to be automatically reloaded after the link is clicked so that the user can see the number go up by one each time it is clicked.
Is this easy using php?
Any help would be appreciated. Maybe someone could just point me in the right direction, I don't even know where to start.
Thanks!
Stuck with similar problem yet differently
Hi, I have everything working according to the steps i have read here in order to create two buttons (Rollover in Dreamweaver HTML) which increment the counter by 1. Unfortunately, they increment each others counters despite the fact that I have two distinct php files, named differently and two txt files also named differently from one another. i am unsure what code to supply but here is the rollover code...
<a href="Vote.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('VoteObama','','images/ObamaSelected.png',1)"><img src="images/ObamaVote.png" alt="Vote for Obama" name="VoteObama" width="280" height="280" border="0"><?php include 'VoteCounter.php';file_put_contents('counter.txt', ((int) file_get_contents('counter.txt')) + 1); ?></a>
<a href="Vote.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('VoteRomney','','images/RomneySelected.png',1)"><img src="images/RomneyVote.png" alt="Vote for Romney" name="VoteRomney" width="280" height="280" border="0"><?php include 'VoteCounterRomney.php';file_put_contents('counterRomney.txt', ((int) file_get_contents('counterRomney.txt')) + 1); ?></a>
Any help is greatly appreciated!