lore_lanu Posted July 8, 2009 Author Share Posted July 8, 2009 if(empty($_SESSION['pos'])) { $_SESSION['pos'] = 0; }else{ $_SESSION['pos'] = $rooms[$_SESSION['pos']][$_GET['number']]; } if(!isset($rooms[$_SESSION['pos']])) { echo "Room error!";//attempting to bypass rooms will cause this exit; } foreach ($rooms[$_SESSION['pos']] as $K=>$roomid) { //$roomid isn't used but its the room your going into //you may use this later !! echo "<a href=\"?number=$K\">$roomid</a><br>"; } Okay so that's what I have posted under my array. Anytime I click on one of the room ids, it should change to a different set of room ids, right? Whenever I do click, however, the url updates (ie ?number=1) but the numbers stay the same. Quote Link to comment https://forums.phpfreaks.com/topic/164851-solved-php-maze-type-thing/page/2/#findComment-871553 Share on other sites More sharing options...
lore_lanu Posted July 8, 2009 Author Share Posted July 8, 2009 I did a little testing and it seems that print $rooms[$_SESSION['pos']][$_GET['number']]; Outputs the right code but since that is the value of $_SESSION['pos'] the code foreach ($rooms[$_SESSION['pos']] as $K=>$roomid) { turns out equaling foreach ($rooms[$rooms[$_SESSION['pos']][$_GET['number']]] as $K=>$roomid) { Or something along those lines. I think that is causing problems.. Quote Link to comment https://forums.phpfreaks.com/topic/164851-solved-php-maze-type-thing/page/2/#findComment-871564 Share on other sites More sharing options...
MadTechie Posted July 8, 2009 Share Posted July 8, 2009 depending on how your code starts the maze.. you may want to change if(empty($_SESSION['pos'])) to if(!isset($_SESSION['pos'])) if your not setting before hand! I also this has moved a little out side the ranges of "design" Quote Link to comment https://forums.phpfreaks.com/topic/164851-solved-php-maze-type-thing/page/2/#findComment-871568 Share on other sites More sharing options...
lore_lanu Posted July 8, 2009 Author Share Posted July 8, 2009 I agree completely, but I think we are done anyways. Thanks a ton for your help! You rock! Topic Solved. Quote Link to comment https://forums.phpfreaks.com/topic/164851-solved-php-maze-type-thing/page/2/#findComment-871573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.