Firstly, thank you for helping me with my Pickle Let me start off by trying to explain what I am trying to do:
Bit of a Pickle :/
5
Firstly, thank you for helping me with my Pickle
Let me start off by trying to explain what I am trying to do:
Problem is I am counting the clicks in PHP, and stuck trying to call the Javascript function after the PHP calls the counting page, then reloads the index(<--- This is when I need that function called...)
I also want to use localStorage in Javascript to keep the element(button) hidden after it is clicked, even if they reload the page, can anybody give me some examples on that one also please?
Here are my script/s:
root/index.php:
root/join.php:
root/includes/functions.php:
root/scripts/javascript.js:
Thanks in advanced
Let me start off by trying to explain what I am trying to do:
Problem is I am counting the clicks in PHP, and stuck trying to call the Javascript function after the PHP calls the counting page, then reloads the index(<--- This is when I need that function called...)
I also want to use localStorage in Javascript to keep the element(button) hidden after it is clicked, even if they reload the page, can anybody give me some examples on that one also please?
Here are my script/s:
root/index.php:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'includes/functions.php'; ?>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/javascript.js"></script>
</head>
<body>
<div id="button">
<a href="join.php?click=1" onclick="hideButton()">JOIN HERE</a><br>
<?php echo $get_count;?> people have joined simply by clicking the link above!
</a>
</body>
</html> Code:
<?php
$click = $_REQUEST['click'];
$file_location = 'clicks.ini';
$update_hits = file($file_location);
$update_count = ($update_hits[0] + 1);
$get_file = $file_location;
$handle_file = fopen($get_file, 'w');
$return_data = "$update_count";
fwrite($handle_file, $return_data);
fclose($handle_file);
echo '<meta http-equiv="refresh" content="0; url=index.php">';
?> root/includes/functions.php:
Code:
<?php //Click Data $file_location = 'clicks.ini'; $get_hits = file($file_location); $get_count = ($get_hits[0]); ?>
Code:
//Hide Button
function hideButton() {
$('#button').hide();
} - Marc Quarles
- [ 1 ] Thanks
- [1] reply
- Blakos
- [1] reply
- Michael71
Next Topics on Trending Feed
-
5