Global Variable not working
<?php
include ("counter.php");
?><HTML><HEAD><?php
function sidney()
{
global $id;
include 'counter.php';
}
sidney();
echo "$id";
?><META name=GENERATOR content="MSHTML 8.00.7600.16722">
</HEAD><BODY><INPUT value='[$id]' name="player number"></BODY></HTML>
please can you explain why [$id] dos not echo a number ?
thanks.
Kniggles
Junior Poster in Training
57 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
You should explain why you are including counter.php twice and show us the code.
chrishea
Nearly a Posting Virtuoso
1,428 posts since Sep 2008
Reputation Points: 210
Solved Threads: 230
You should explain why you are including counter.php twice and show us the code.
counter.php
<?php
$count_my_page = ("hitcounter.txt");
$id = file($count_my_page);
$id[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $id[0];
?>
the 1st it runs is when the page loads, now i am trying to take that number and place it into a read only text box1
Kniggles
Junior Poster in Training
57 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0