<?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.

You should explain why you are including counter.php twice and show us the code.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.