This is the question from the book "Beginning PHP5,Apache,MYsql web development.
Question fro chapter-2 exercise
ques--> "Using functions, write a program that keeps track of how many times a visitor has loaded the page."
In the book, they have written--> //list the movies
echo “<table>”;
$numlist = 1;
while ($numlist <= $_POST[“num”]) {
echo “<tr>”;
echo “<td>”;
echo pos($favmovies);
echo “</td”>;
next($favmovies);
$numlist = $numlist + 1;
echo “</tr>”;
}
echo “</table>”;
But i don't think this is the answer because it just putting the movie result inside a table.
I have written one program myself for this question but it is not working correctly.
Here it is-->
<?php
echo " hello welcome here";
$counter1=0;
$counter;
function counter()
{
global $counter1,$counter;
$counter1++;
echo "you have visited this page for ".$counter1;
$counter=$counter1;
}
$counter=$counter1;
counter();
?>
Need help...