Hello ,
I am stuck on this line of code

echo $hits[0];

i am trying to get it to echo into a text box as an integar. at the moment the code

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
?>

when run on

<?php
    include ("counter.php");
    ?>

just gives me a number
I have been thinking along trying to get

<?php
    include ("counter.php");
    ?><HTML><HEAD>
</HEAD><BODY><INPUT value="ehco $hits" name="Hit counter"></BODY></HTML>

to work ,
thanks.

first off lets fix the counter.php code

<?php
$count_my_page = ("hitcounter.txt");//please take in consideration that the file hitcounter.txt already exists
$hits = file($count_my_page);
$hits[0]++;
$fp = fopen($count_my_page , "w");
fputs($fp , $hits[0]);
fclose($fp);
echo $hits[0];
?>

And now to embed the code in a textbox

<html>
<head>
</head>
<body>
<input name="Hit Counter" type="text" value="<?php include ("counter.php"); ?>">
</body>
</html>

I hope this solves your problem
please reply back if things didn't work for you.

<?php
include ("counter.php");
?>
<HTML>
<title>
Verified by tomato.pgn
</title>
<HEAD>
</HEAD>
<BODY><INPUT type="text" value=<?php echo $hits ?> name="Hit counter">
</BODY>
</HTML>

Hope this will fix ur error.....
if any other problem PM me....

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.