Hi people !
I'm new out here and newbie in scripting. I succeeded doing the whole website but right now, I got a real problem.
I made a click button counter with PHP (same as Facebook like button) and it works very good ! As you close the page, delete cookies, do anything, the count stays ! YEEEA !
The issue here is when I click the button (being an 'a href' to my php script) it refreshes the page, and THIS, is annoying. I want it to work without refreshing; You click and you go !
Heres the code;
<?php
if(!file_exists('medias/counter.txt')){
file_put_contents('medias/counter.txt', '0');
}
if($GET['click'] == 'yes'){
file_put_contents('medias/counter.txt', ((int) file_get_contents('medias/counter.txt')) + 1);
header('Location: ' . $SERVER['SCRIPT_NAME']);
die;
}
?>
<head>
</head>
<body>
<p><a href="?click=yes"><img src="images/like.png"></a>| <?php echo file_get_contents('medias/counter.txt'); ?>like this.</p>
</body>
Can someone help me out on this one ?
Would be greatly appreciated !!!
Thank y'all !
-eragraff