This should be pretty simple but all the searches I do turn up looping through an associative array. I’ve created an array in a Session contining links clicked so that when someone returns from a thank you page the links they clicked on can be disabled. When you go from the page with links to the thank you page I add it to the Session array:
//add $linkVisted array to the session
$_SESSION[‘linkVisted’] = $linkVisted;
//add the next number to the array
array_push($linkVisted,$link);
This works and returns the following output when I return to the links page:
Array ( [linkVisted] => Array ( [0] => 3 [1] => 3 [2] => 1 [3] => 1 [4] => 8 [5] => 9 ) )
Now, how do I loop through this array to compare each link’s number with these numbers? When I try this I get an array length of 1 - because there is only one array - so how do get the number of elements (9 here) and loop through them?
for ($i = 1; $i < count($linkVisted); ++$i) {
echo $linkVisted[$i];
}
Thanks!
P.S. The Kirupa form field doesn’t work in Firefox. Can’t see a cursor, can’t delete :([URL=“http://www.kirupa.com/forum/newthread.php?do=postthread&f=11”]