hello,
i have been reading Beginning PHP4 for severals days now. its time that i ask some of your expert thoughts about this one. i just need to clarify thru someone else what the "...".SID."&whichpage..." below does...
there are comments in the code.. pls read them...
<?php
session_register("view1count");
session_register("view2count");
session_register("view3count");
session_register("view4count");
//page_count.php
?>
<?php
if (!$view1count) $view1count = 0;
if (!$view2count) $view2count = 0;
if (!$view3count) $view3count = 0;
if (!$view4count) $view4count = 0;
echo "<HTML><HEAD><TITLE>Web Page Hit Counter</TITLE></HEAD><BODY>";
if ($_GET['whichpage']) {
echo "<B>You are currently on page $whichpage.</B><BR><BR>\n";
$GLOBALS["view${whichpage}count"]++;
}
for ($i=1;$i<=4;$i++) {
if ($whichpage == $i) {
//What's up with SID and &whichpage???
//what is the use of the "&" (without the quotes)
//do we always use something like this: ".SID."&whichpage=$i" when sessions?
//like we "connect" SID and whichpage with a "&" ???
echo "<B><A HREF = \"$PHP_SELF?".SID."&whichpage=$i\">Page $i</A></B>";
} else {
echo "<A HREF = \"$PHP_SELF?".SID."&whichpage=$i\">Page $i</A>";
}
echo ", which you have chosen ".$GLOBALS["view${i}count"]." times.<BR>\n";
}
echo "\n\n<BR><BR>\n\n";
echo "</BODY></HTML>";
?>
that's about it...i fairly understand what are sessions and the SID...
the book im reading is quite easy to understand. but i need more info on what "...".SID."&whichpage..." is actually doing.
i appreciate your reply and thank you for satifying my curiousity...
🙂
cheers 😃